19 lines
526 B
Go
19 lines
526 B
Go
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)
|
|
}
|