mcppool

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 11 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 MCP server connections, creating them on demand.

func New

func New(cfg *config.Config) *Pool

New creates a new connection pool.

func (*Pool) CallTool

func (p *Pool) CallTool(ctx context.Context, server, tool string, argsJSON json.RawMessage) (*mcp.CallToolResult, error)

CallTool invokes a tool on a server.

func (*Pool) CallToolWithInfo added in v0.1.12

func (p *Pool) CallToolWithInfo(ctx context.Context, server string, info *ToolInfo, argsJSON json.RawMessage) (*mcp.CallToolResult, error)

CallToolWithInfo invokes a resolved tool on a server.

func (*Pool) Close

func (p *Pool) Close(server string)

Close disconnects a specific server.

func (*Pool) CloseAll

func (p *Pool) CloseAll()

CloseAll disconnects all servers.

func (*Pool) ListTools

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

ListTools returns the tools available on a server.

func (*Pool) Reset added in v0.1.6

func (p *Pool) Reset(cfg *config.Config)

Reset swaps the underlying config and drops all active connections.

func (*Pool) ToolInfoByName

func (p *Pool) ToolInfoByName(ctx context.Context, server, tool string) (*ToolInfo, error)

ToolInfoByName returns metadata and schemas for a specific tool.

func (*Pool) ToolSchema

func (p *Pool) ToolSchema(ctx context.Context, server, tool string) (json.RawMessage, error)

ToolSchema returns the input schema for a specific tool.

type ToolInfo

type ToolInfo struct {
	Name         string
	Description  string
	InputSchema  json.RawMessage
	OutputSchema json.RawMessage
}

ToolInfo is a simplified tool descriptor returned by ListTools.

Jump to

Keyboard shortcuts

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