Documentation
¶
Index ¶
- Variables
- func WithDispatchGuard(ctx context.Context, guard func() error) context.Context
- type Client
- func Connect(ctx context.Context, accessToken string) (*Client, error)
- func ConnectTo(ctx context.Context, endpoint, accessToken string, base *http.Client) (*Client, error)
- func ConnectToWithTokenProvider(ctx context.Context, endpoint string, provider TokenProvider, ...) (*Client, error)
- func ConnectWithTokenProvider(ctx context.Context, provider TokenProvider) (*Client, error)
- func (c *Client) CallTool(ctx context.Context, name string, arguments map[string]any) (*ToolOutcome, error)
- func (c *Client) Close() error
- func (c *Client) ListResourceTemplates(ctx context.Context) ([]*mcp.ResourceTemplate, error)
- func (c *Client) ListResources(ctx context.Context) ([]*mcp.Resource, error)
- func (c *Client) ListTools(ctx context.Context) ([]*mcp.Tool, error)
- func (c *Client) ReadResource(ctx context.Context, uri string) (*ResourceOutcome, error)
- type ResourceOutcome
- type TokenProvider
- type ToolOutcome
- type ToolState
Constants ¶
This section is empty.
Variables ¶
var ErrNotDispatched = errors.New("MCP request was not dispatched")
ErrNotDispatched distinguishes a failed local authorization/preflight check from a transport error after a write may have reached the gateway.
ErrUnauthorized means the gateway explicitly rejected authentication. It is not an unknown write outcome and never triggers an automatic login or replay.
Functions ¶
func WithDispatchGuard ¶
WithDispatchGuard checks session-local state after token refresh and directly before dispatch. A rejected guard never sends the HTTP request. It is used to prevent a preview authorized before reauthentication from being confirmed.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func ConnectWithTokenProvider ¶
func ConnectWithTokenProvider(ctx context.Context, provider TokenProvider) (*Client, error)
func (*Client) ListResourceTemplates ¶
func (*Client) ListResources ¶
func (*Client) ReadResource ¶
type ResourceOutcome ¶
type ResourceOutcome struct {
URI string `json:"uri"`
Result *mcp.ReadResourceResult `json:"result"`
}
func (*ResourceOutcome) HumanText ¶
func (o *ResourceOutcome) HumanText() string
type TokenProvider ¶
TokenProvider is called for each HTTP request, allowing the CLI-owned OAuth service to refresh expiring credentials without reconnecting or replaying a tool call. Calls to a provider are serialized by this package.
type ToolOutcome ¶
type ToolOutcome struct {
Tool string `json:"tool"`
State ToolState `json:"state"`
PreviewID string `json:"preview_id,omitempty"`
Result *mcp.CallToolResult `json:"result"`
}
func NewToolOutcome ¶
func NewToolOutcome(name string, result *mcp.CallToolResult) *ToolOutcome
func (*ToolOutcome) HumanText ¶
func (o *ToolOutcome) HumanText() string
func (*ToolOutcome) IsError ¶
func (o *ToolOutcome) IsError() bool
func (*ToolOutcome) IsPreview ¶
func (o *ToolOutcome) IsPreview() bool