feat(tools): tool interface + helpers

This commit is contained in:
Mathias Bergqvist
2026-05-04 21:27:50 +02:00
parent 4ebb1eef6d
commit 18eadc0ae9

24
internal/tools/tool.go Normal file
View File

@@ -0,0 +1,24 @@
package tools
import (
"context"
"encoding/json"
"gitea.d-ma.be/mathias/gitea-mcp/internal/registry"
)
// Tool implements registry.Tool.
type Tool = registry.Tool
func textOK(v any) (json.RawMessage, error) {
return json.Marshal(v)
}
func parseArgs(raw json.RawMessage, dst any) error {
if len(raw) == 0 {
return json.Unmarshal([]byte("{}"), dst)
}
return json.Unmarshal(raw, dst)
}
func _ctx(ctx context.Context) context.Context { return ctx } // stub for future hooks