client

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package client implements the MCP client logic.

Package client implements the MCP client logic.

Index

Constants

This section is empty.

Variables

View Source
var ErrConnectionLost = errors.New("sse connection lost")

ErrConnectionLost indicates the SSE connection was dropped unexpectedly

Functions

This section is empty.

Types

type ConnectionError

type ConnectionError struct {
	Err       error
	Temporary bool
}

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

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

ListTools overrides the base client's ListTools to add error detection

func (*SSEMCPClientWrapper) Start

func (w *SSEMCPClientWrapper) Start(ctx context.Context) error

Start overrides the base client's Start method to enable error monitoring

Jump to

Keyboard shortcuts

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