diff --git a/docs/tools-custom/mcp-tools.md b/docs/tools-custom/mcp-tools.md index b939bf1d8d..3b9b1dbb78 100644 --- a/docs/tools-custom/mcp-tools.md +++ b/docs/tools-custom/mcp-tools.md @@ -40,7 +40,7 @@ This section demonstrates how to integrate tools from external MCP (Model Contex The `McpToolset` class is ADK's primary mechanism for integrating tools from an MCP server. When you include an `McpToolset` instance in your agent's `tools` list, it automatically handles the interaction with the specified MCP server. Here's how it works: -1. **Connection Management:** On initialization, `McpToolset` establishes and manages the connection to the MCP server. This can be a local server process (using `StdioConnectionParams` for communication over standard input/output) or a remote server (using `SseConnectionParams` for Server-Sent Events). The toolset also handles the graceful shutdown of this connection when the agent or application terminates. +1. **Connection Management:** On initialization, `McpToolset` establishes and manages the connection to the MCP server. This can be a local server process (using `StdioConnectionParams` for communication over standard input/output), a remote server using `SseConnectionParams` for Server-Sent Events, or a stateless HTTP-based connection with `StreamableHTTPConnectionParams`. The toolset also handles the graceful shutdown of this connection when the agent or application terminates. For better stability in production, you can configure timeouts like `timeout` and `sse_read_timeout` in the connection parameters. 2. **Tool Discovery & Adaptation:** Once connected, `McpToolset` queries the MCP server for its available tools (via the `list_tools` MCP method). It then converts the schemas of these discovered MCP tools into ADK-compatible `BaseTool` instances. 3. **Exposure to Agent:** These adapted tools are then made available to your `LlmAgent` as if they were native ADK tools. 4. **Proxying Tool Calls:** When your `LlmAgent` decides to use one of these tools, `McpToolset` transparently proxies the call (using the `call_tool` MCP method) to the MCP server, sends the necessary arguments, and returns the server's response back to the agent. @@ -870,7 +870,6 @@ if __name__ == '__main__': asyncio.run(async_main()) except Exception as e: print(f"An error occurred: {e}") -``` ## Key considerations @@ -1279,4 +1278,4 @@ McpToolset( * [Model Context Protocol Documentation](https://modelcontextprotocol.io/ ) * [MCP Specification](https://modelcontextprotocol.io/specification/) -* [MCP Python SDK & Examples](https://github.com/modelcontextprotocol/) +* [MCP Python SDK & Examples](https://github.com/modelcontextprotocol/) \ No newline at end of file