mcpclient

package
v0.0.0-...-dd2decd Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

Pool manages a set of named MCP client sessions. It is safe for concurrent use: sessions can be connected, queried, and disconnected from multiple goroutines.

func NewPool

func NewPool() *Pool

NewPool returns a ready-to-use Pool with no active connections.

func (*Pool) CallTool

func (p *Pool) CallTool(ctx context.Context, server, tool string, args map[string]any) (*mcp.CallToolResult, error)

CallTool invokes a tool by name on a connected server with the given args.

func (*Pool) Close

func (p *Pool) Close() error

Close disconnects all sessions and drains the pool. Errors from individual sessions are collected and returned together.

func (*Pool) Connect

func (p *Pool) Connect(ctx context.Context, name string, ref *mcpconfig.MCPServerRef) error

Connect creates a new MCP client session for the given server ref. It returns an error if the name is already connected or if the transport handshake fails.

func (*Pool) Disconnect

func (p *Pool) Disconnect(name string) error

Disconnect closes the session for the named server and removes it from the pool.

func (*Pool) ListTools

func (p *Pool) ListTools(ctx context.Context, server string) ([]mcp.Tool, error)

ListTools enumerates available tools on a connected server.

Jump to

Keyboard shortcuts

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