From 18eadc0ae90f8cf49fc205aa5e9113c365ea1609 Mon Sep 17 00:00:00 2001 From: Mathias Bergqvist Date: Mon, 4 May 2026 21:27:50 +0200 Subject: [PATCH] feat(tools): tool interface + helpers --- internal/tools/tool.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 internal/tools/tool.go diff --git a/internal/tools/tool.go b/internal/tools/tool.go new file mode 100644 index 0000000..b698f70 --- /dev/null +++ b/internal/tools/tool.go @@ -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