feat: add MCP enums, ToolError, and Caller

This commit is contained in:
2026-09-01 11:26:23 -05:00
parent 7d549fda58
commit e80095525d
5 changed files with 128 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
package client
import (
"context"
"encoding/json"
)
// Caller invokes an MCP tool by name and returns its JSON result.
type Caller interface {
Call(ctx context.Context, name string, args map[string]any) (json.RawMessage, error)
}
// Func adapts a function to Caller so tests can inject a stub.
type Func func(ctx context.Context, name string, args map[string]any) (json.RawMessage, error)
func (f Func) Call(ctx context.Context, name string, args map[string]any) (json.RawMessage, error) {
return f(ctx, name, args)
}