Documentation
¶
Index ¶
- Constants
- func BuildCallError(serverName, toolName, operation string, err error) error
- func BuildInitializeRequest(clientName string) mcp.InitializeRequest
- func BuildTimeoutError(serverName, operation string, timeout time.Duration) error
- func Handshake(ctx context.Context, c Initializer, serverName string, srv config.MCPServer, ...) (*mcp.InitializeResult, error)
- func IsAuthorizationRequired(err error) bool
- func PublishError(serverName, message string)
- func PublishWarn(serverName, message string)
- func ResolveTimeout(raw string, fallback time.Duration) time.Duration
- func WithTimeout(parent context.Context, timeout time.Duration) (context.Context, context.CancelFunc)
- type Client
- type Initializer
Constants ¶
const ( DefaultOperationTimeout = 30 * time.Second DefaultDiscoveryTimeout = 15 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func BuildCallError ¶
func BuildInitializeRequest ¶
func BuildInitializeRequest(clientName string) mcp.InitializeRequest
func BuildTimeoutError ¶
func Handshake ¶ added in v0.703.4
func Handshake(ctx context.Context, c Initializer, serverName string, srv config.MCPServer, clientName string) (*mcp.InitializeResult, error)
Handshake initializes c against the configured server and reports the outcome on the extension mcp topic. clientName identifies the part of the host that is connecting and travels both in the MCP client info and in the event, so an operator can tell a discovery pass from a gateway connection.
The error is returned unchanged: callers keep whatever handling they had, and the event is a side effect that cannot fail the connection.
func IsAuthorizationRequired ¶ added in v0.631.1
IsAuthorizationRequired reports whether err indicates that an MCP server needs interactive OAuth authorization (e.g. no token yet, or a refresh token that no longer works). Callers such as the agent layer and the future `pando mcp login` command use this to detect that a tool call failure means "the user needs to (re-)authenticate this server" rather than a generic operational error.
func PublishError ¶
func PublishError(serverName, message string)
func PublishWarn ¶
func PublishWarn(serverName, message string)
func WithTimeout ¶
Types ¶
type Client ¶
type Client interface {
Initialize(ctx context.Context, req mcp.InitializeRequest) (*mcp.InitializeResult, error)
ListTools(ctx context.Context, req mcp.ListToolsRequest) (*mcp.ListToolsResult, error)
CallTool(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
Close() error
}
type Initializer ¶ added in v0.703.4
type Initializer interface {
Initialize(ctx context.Context, req mcp.InitializeRequest) (*mcp.InitializeResult, error)
}
Initializer is the one method Handshake needs. It is declared here rather than taking Client so that the gateway's pooled client and the agent's own client interface both satisfy it without conversion.