Documentation
¶
Overview ¶
Package mcpbridge registers the tools of an MCP server as cortex tools.
The host owns the *mcp.ClientSession and its lifetime. The bridge lists the server's tools, maps each to an llm.Tool plus a handler that calls the server, and tells the engine which of them are safe to run again after a crash.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EngineOptions ¶
func EngineOptions(ctx context.Context, cs *mcp.ClientSession, opts Options) ([]engine.Option, error)
EngineOptions returns a WithTool option for every tool, plus a WithToolRetrySafe option naming the read-only ones.
Types ¶
type Options ¶
type Options struct {
// Prefix is prepended to every tool name, for example "github_".
Prefix string
// Include filters the server's tools. Nil includes every tool.
Include func(t *mcp.Tool) bool
// MaxResultBytes caps a tool result. A larger result is a tool error.
// Zero means 1 MiB.
MaxResultBytes int
}
Options tunes how a server's tools are exposed.
type Tool ¶
type Tool struct {
// Def is the definition advertised to the model. Name carries the prefix
// and Parameters is the server's input schema.
Def llm.Tool
// Handler calls the server.
Handler engine.ToolHandler
// ReadOnly mirrors the readOnlyHint annotation.
ReadOnly bool
// Destructive mirrors the destructiveHint annotation. It defaults to
// true when the annotation is unset and the tool is not read-only.
Destructive bool
}
Tool is one server tool, ready to register with the engine.
Click to show internal directories.
Click to hide internal directories.