From a9db38461fed69b381cca454f7bbb25e8f503779 Mon Sep 17 00:00:00 2001 From: Eric Zhu Date: Mon, 10 Feb 2025 23:55:13 -0800 Subject: [PATCH] doc: Update API doc for MCP tool to include installation instructions (#5482) --- .../autogen-ext/src/autogen_ext/tools/mcp/_factory.py | 8 ++++++++ .../autogen-ext/src/autogen_ext/tools/mcp/_sse.py | 8 ++++++++ .../autogen-ext/src/autogen_ext/tools/mcp/_stdio.py | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_factory.py b/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_factory.py index fcb29e3c4a..3eb8634b36 100644 --- a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_factory.py +++ b/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_factory.py @@ -12,6 +12,14 @@ async def mcp_server_tools( This factory function connects to an MCP server and returns adapters for all available tools. The adapters can be directly assigned to an AutoGen agent's tools list. + .. note:: + + To use this function, you need to install `mcp` extra for the `autogen-ext` package. + + .. code-block:: bash + + pip install -U "autogen-ext[mcp]" + Args: server_params (McpServerParams): Connection parameters for the MCP server. Can be either StdioServerParams for command-line tools or diff --git a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_sse.py b/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_sse.py index 7b875649a4..252af7ce50 100644 --- a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_sse.py +++ b/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_sse.py @@ -25,6 +25,14 @@ class SseMcpToolAdapter( with AutoGen agents. Common use cases include integrating with remote MCP services, cloud-based tools, and web APIs that implement the Model Context Protocol (MCP). + .. note:: + + To use this class, you need to install `mcp` extra for the `autogen-ext` package. + + .. code-block:: bash + + pip install -U "autogen-ext[mcp]" + Args: server_params (SseServerParameters): Parameters for the MCP server connection, including URL, headers, and timeouts diff --git a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_stdio.py b/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_stdio.py index 629b1a46ec..4f827785e9 100644 --- a/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_stdio.py +++ b/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_stdio.py @@ -24,6 +24,15 @@ class StdioMcpToolAdapter( with AutoGen agents. Common use cases include wrapping command-line tools and local services that implement the Model Context Protocol (MCP). + .. note:: + + To use this class, you need to install `mcp` extra for the `autogen-ext` package. + + .. code-block:: bash + + pip install -U "autogen-ext[mcp]" + + Args: server_params (StdioServerParams): Parameters for the MCP server connection, including command to run and its arguments