Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallResult ¶
CallResult is the outcome of a tools/call request.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool manages MCP server connections for a single session. It is created in session.initBrain and torn down when the session context is cancelled (stdio child processes are killed via their exec.CommandContext).
func NewPool ¶
func NewPool(ctx context.Context, configs []ServerConfig) *Pool
NewPool connects to all configured MCP servers, runs the initialize+tools/list handshake for each, and returns a ready pool.
Servers that fail to start are logged and skipped so a single broken server does not prevent the rest from working.
The caller is responsible for deny-list URL filtering before passing configs; see session.initBrain which calls isURLDenied before adding an entry.
func (*Pool) Call ¶
Call dispatches a tool call to the appropriate MCP server and returns the result. qualifiedName must be of the form "mcp__<server>__<tool>". Internal vix params (cwd, allowed_dirs, headless, _session, confirmed) are stripped before forwarding to the server.
func (*Pool) RequiresConfirmation ¶
RequiresConfirmation reports whether the server that owns qualifiedName has require_confirmation: true.
func (*Pool) ServerCount ¶
ServerCount returns the number of successfully connected MCP servers.
func (*Pool) ToolSchemas ¶
ToolSchemas returns neutral llm.ToolParam definitions for every MCP tool in the pool. Tool names are the qualified form "mcp__<server>__<tool>".
type ServerConfig ¶
type ServerConfig struct {
// Name is a unique identifier used to prefix tool names: mcp__<name>__<tool>.
Name string `json:"name"`
// Type is the transport: "stdio" (default) or "url".
Type string `json:"type,omitempty"`
// Command and Args are used for stdio servers.
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
// Env adds extra environment variables for the stdio child process.
Env map[string]string `json:"env,omitempty"`
// URL is used for HTTP/SSE servers.
URL string `json:"url,omitempty"`
// Headers are sent with every HTTP request (e.g. Authorization).
// Values of the form "${VAR}" are expanded from the environment at connect time.
Headers map[string]string `json:"headers,omitempty"`
// AllowedTools, when non-empty, restricts which tools from this server are
// exposed to the LLM. Unlisted tools are silently dropped after tools/list.
AllowedTools []string `json:"allowed_tools,omitempty"`
// RequireConfirmation makes every tool call from this server require explicit
// user approval via the standard confirm_request / session.confirm flow.
RequireConfirmation bool `json:"require_confirmation,omitempty"`
}
ServerConfig describes a single MCP server entry from settings.json.