feat: add MCP enums, ToolError, and Caller
This commit is contained in:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user