feat: add JSON-RPC MCP Call with ToolError
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Client is a Robinhood Agentic MCP client.
|
||||
type Client struct {
|
||||
URL, Token, Name, Version string
|
||||
HTTP *http.Client
|
||||
Hook Caller
|
||||
session any
|
||||
}
|
||||
|
||||
// Call invokes an MCP tool by name and returns its JSON result.
|
||||
func (c *Client) Call(ctx context.Context, name string, args map[string]any) (json.RawMessage, error) {
|
||||
if c.Hook != nil {
|
||||
return c.Hook.Call(ctx, name, args)
|
||||
}
|
||||
return c.rpcCall(ctx, name, args)
|
||||
}
|
||||
Reference in New Issue
Block a user