mcpclient

package
v0.631.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOperationTimeout = 30 * time.Second
	DefaultDiscoveryTimeout = 15 * time.Second
)

Variables

This section is empty.

Functions

func BuildCallError

func BuildCallError(serverName, toolName, operation string, err error) error

func BuildInitializeRequest

func BuildInitializeRequest(clientName string) mcp.InitializeRequest

func BuildTimeoutError

func BuildTimeoutError(serverName, operation string, timeout time.Duration) error

func IsAuthorizationRequired added in v0.631.1

func IsAuthorizationRequired(err error) bool

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 ResolveTimeout

func ResolveTimeout(raw string, fallback time.Duration) time.Duration

func WithTimeout

func WithTimeout(parent context.Context, timeout time.Duration) (context.Context, context.CancelFunc)

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
}

func New

func New(ctx context.Context, serverName string, srv config.MCPServer) (Client, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL