Documentation
¶
Overview ¶
Package mcptool provides integration with the Model Context Protocol (MCP). It allows agents to connect to external MCP servers via stdio (subprocess) or HTTP (SSE / streamable HTTP) and expose their tools as tool.Tool / tool.FuncTool instances.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTool ¶
AddTool registers a tool.FuncTool on the given mcp.Server so it is exposed to MCP clients. Native mcp.Content and []mcp.Content results are returned as MCP content blocks; they must contain content types valid in a tool response. Nil content entries are represented as the text "null". A *mcp.CallToolResult is returned as-is. Array return schemas and their structured results are wrapped in an object with a "result" property so structured output also works with older MCP clients. The text content retains the original JSON for existing clients. Explicit MCP results and MCP/framework content bypass this wrapping. When an output schema is advertised, callers returning these types must provide structured content matching that schema for successful results.
Types ¶
This section is empty.