Documentation
¶
Overview ¶
Package client implements the MCP client logic.
Package client implements the MCP client logic.
Index ¶
- Variables
- type ConnectionError
- type SSEMCPClient
- type SSEMCPClientWrapper
- func (w *SSEMCPClientWrapper) CallTool(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func (w *SSEMCPClientWrapper) Close()
- func (w *SSEMCPClientWrapper) ListTools(ctx context.Context, request mcp.ListToolsRequest) (*mcp.ListToolsResult, error)
- func (w *SSEMCPClientWrapper) Start(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ErrConnectionLost = errors.New("sse connection lost")
ErrConnectionLost indicates the SSE connection was dropped unexpectedly
Functions ¶
This section is empty.
Types ¶
type ConnectionError ¶
ConnectionError represents a specific type of error related to SSE connections
func (*ConnectionError) Error ¶
func (e *ConnectionError) Error() string
func (*ConnectionError) Unwrap ¶
func (e *ConnectionError) Unwrap() error
type SSEMCPClient ¶
type SSEMCPClient = client.SSEMCPClient
SSEMCPClient provides the Server-Sent Events implementation of the MCP client
func NewSSEMCPClient ¶
func NewSSEMCPClient(url string) (*SSEMCPClient, error)
NewSSEMCPClient creates a new SSE MCP client
type SSEMCPClientWrapper ¶
type SSEMCPClientWrapper struct { *client.SSEMCPClient URL string Logger log.Logger OnErrorCallback func(error) OnCloseCallback func() ErrorChannelDone bool // contains filtered or unexported fields }
SSEMCPClientWrapper enhances the SSE MCP client with better error handling and connection monitoring
func NewEnhancedMCPClient ¶
func NewEnhancedMCPClient(url string, logger log.Logger, onError func(error), onClose func()) (*SSEMCPClientWrapper, error)
NewEnhancedMCPClient creates an MCP client with improved error handling It wraps the standard SSE client with our enhanced error detection
func NewEnhancedSSEClient ¶
func NewEnhancedSSEClient(url string, logger log.Logger, onError func(error), onClose func()) (*SSEMCPClientWrapper, error)
NewEnhancedSSEClient creates a new enhanced SSE client that monitors for errors
func (*SSEMCPClientWrapper) CallTool ¶
func (w *SSEMCPClientWrapper) CallTool(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)
CallTool overrides the base client's CallTool to add error detection
func (*SSEMCPClientWrapper) Close ¶
func (w *SSEMCPClientWrapper) Close()
Close overrides the base client's Close to ensure proper cleanup
func (*SSEMCPClientWrapper) ListTools ¶
func (w *SSEMCPClientWrapper) ListTools(ctx context.Context, request mcp.ListToolsRequest) (*mcp.ListToolsResult, error)
ListTools overrides the base client's ListTools to add error detection