Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildMCPTool ¶
func BuildMCPTool(toolName string, meta *ToolMetadata) (_ *mcp.ToolBuilder, err error)
BuildMCPTool creates an mcp.ToolBuilder from ToolMetadata. Returns an error if any parameter declares an unknown type, or if meta.UI carries an invalid resourceURI or visibility value — ToolBuilder. UIResource/Visibility validate those by panicking (they're meant to catch a Go caller's own typo, e.g. a literal "ui://..." string), which would be the wrong failure mode here: meta.UI came from parsed data (a .toml file, a decorator's keyword arguments, ...), not a Go call site, so an invalid value is reported the same way any other bad metadata in this function is — as a returned error — by recovering that specific panic.
Types ¶
type ToolMetadata ¶
type ToolMetadata struct {
Description string
Keywords []string
Parameters []ToolParameter
Discoverable bool
// UI links the tool to a companion UI resource per the MCP Apps extension
// (SEP-1865). When set, BuildMCPTool calls ToolBuilder.UIResource so the
// tool's _meta.ui.resourceUri is populated. See mcp.UIToolMeta.
UI *mcp.UIToolMeta
// Icons attaches visual identifiers to the tool's tools/list descriptor.
// See mcp.Icon.
Icons []mcp.Icon
// Title is the tool's human-readable display name (the spec's
// Tool.title). Empty means none.
Title string
// The behaviour hints (the spec's Tool.annotations). Each is optional:
// nil leaves the hint out, so clients assume the spec default (not
// read-only, possibly destructive, not idempotent, open world). They
// are hints only; what a tool may do must be enforced by the server.
ReadOnly *bool // readOnlyHint: the tool does not modify its environment
Destructive *bool // destructiveHint: it may perform destructive updates
Idempotent *bool // idempotentHint: repeating a call has no further effect
OpenWorld *bool // openWorldHint: it interacts with external entities
}
ToolMetadata defines metadata for an MCP tool