client

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements MCPClient using the official go-sdk.

func NewClient

func NewClient(serverURI string) *Client

NewClient creates a new MCP client.

func (*Client) CallTool

func (c *Client) CallTool(ctx context.Context, name, args string) (schema.ToolResult, error)

CallTool sends tools/call and converts the response to schema.ToolResult.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, transport mcp.Transport) error

Connect establishes a connection to the server via the given transport.

func (*Client) Disconnect

func (c *Client) Disconnect() error

Disconnect closes the session.

func (*Client) ListTools

func (c *Client) ListTools(ctx context.Context) ([]schema.ToolDef, error)

ListTools sends tools/list and converts the response to schema.ToolDef slice.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping sends a ping request to the server.

type Lifecycle

type Lifecycle interface {
	Connect(ctx context.Context, transport mcp.Transport) error
	Disconnect() error
	Ping(ctx context.Context) error
}

Lifecycle manages the connection lifecycle of an MCP client.

type MCPClient

type MCPClient interface {
	tool.ExternalToolCaller
	Lifecycle
	ListTools(ctx context.Context) ([]schema.ToolDef, error)
}

MCPClient combines tool calling with connection lifecycle management.

Jump to

Keyboard shortcuts

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