command

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

Package command implements a registry for Model Context Protocol (MCP) servers. It provides integration with MCP tools, allowing agents to dynamically discover and invoke tools exposed by MCP servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new registry of MCP servers.

func (*Registry) Attach added in v0.3.0

func (r *Registry) Attach(id string, server Server) error

Attach MCP server to the registry, making its tools available to the agent. The server is identified by a unique prefix, which is used to namespace tool names (e.g., fs_read). Tool names use underscore separator (prefix_toolname) due to AWS Bedrock constraints which only allow [a-zA-Z0-9_-] characters. The first token before underscore is always the server prefix. Each server runs independently, and its tools are registered with the prefix to avoid naming conflicts.

func (*Registry) Context added in v0.0.20

func (r *Registry) Context() chatter.Registry

Context returns the registry as LLM embeddable schema. It fetches the list of available tools from all attached MCP servers.

func (*Registry) Invoke added in v0.0.20

func (r *Registry) Invoke(reply *chatter.Reply) (thinker.Phase, chatter.Message, error)

Invoke executes the tools requested by the LLM via the appropriate MCP server.

type Server added in v0.3.0

type Server interface {
	ListTools(ctx context.Context, params *mcp.ListToolsParams) (*mcp.ListToolsResult, error)
	CallTool(ctx context.Context, params *mcp.CallToolParams) (*mcp.CallToolResult, error)
	Close() error
}

MCP Server interface

Jump to

Keyboard shortcuts

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