Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/google/adk/tools/mcp_tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
from .mcp_session_manager import StdioConnectionParams
from .mcp_session_manager import StreamableHTTPConnectionParams
from .mcp_tool import MCPTool
from .mcp_tool import McpTool
from .mcp_toolset import MCPToolset
from .mcp_toolset import McpToolset

__all__.extend([
'adk_to_mcp_tool_type',
'gemini_to_json_schema',
'McpTool',
'MCPTool',
'McpToolset',
'MCPToolset',
'StdioConnectionParams',
'SseConnectionParams',
'StdioConnectionParams',
'StreamableHTTPConnectionParams',
])

Expand Down
15 changes: 14 additions & 1 deletion src/google/adk/tools/mcp_tool/mcp_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import base64
import logging
from typing import Optional
import warnings

from fastapi.openapi.models import APIKeyIn
from google.genai.types import FunctionDeclaration
Expand Down Expand Up @@ -52,7 +53,7 @@
logger = logging.getLogger("google_adk." + __name__)


class MCPTool(BaseAuthenticatedTool):
class McpTool(BaseAuthenticatedTool):
"""Turns an MCP Tool into an ADK Tool.

Internally, the tool initializes from a MCP Tool, and uses the MCP Session to
Expand Down Expand Up @@ -216,3 +217,15 @@ async def _get_headers(
)

return headers


class MCPTool(McpTool):
"""Deprecated name, use `McpTool` instead."""

def __init__(self, *args, **kwargs):
warnings.warn(
"MCPTool class is deprecated, use `McpTool` instead.",
DeprecationWarning,
stacklevel=2,
)
super().__init__(*args, **kwargs)
19 changes: 16 additions & 3 deletions src/google/adk/tools/mcp_tool/mcp_toolset.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from typing import Optional
from typing import TextIO
from typing import Union
import warnings

from pydantic import model_validator
from typing_extensions import override
Expand Down Expand Up @@ -59,7 +60,7 @@
logger = logging.getLogger("google_adk." + __name__)


class MCPToolset(BaseToolset):
class McpToolset(BaseToolset):
"""Connects to a MCP Server, and retrieves MCP Tools into ADK Tools.

This toolset manages the connection to an MCP server and provides tools
Expand Down Expand Up @@ -190,7 +191,7 @@ def from_config(
cls: type[MCPToolset], config: ToolArgsConfig, config_abs_path: str
) -> MCPToolset:
"""Creates an MCPToolset from a configuration object."""
mcp_toolset_config = MCPToolsetConfig.model_validate(config.model_dump())
mcp_toolset_config = McpToolsetConfig.model_validate(config.model_dump())

if mcp_toolset_config.stdio_server_params:
connection_params = mcp_toolset_config.stdio_server_params
Expand All @@ -211,7 +212,19 @@ def from_config(
)


class MCPToolsetConfig(BaseToolConfig):
class MCPToolset(McpToolset):
"""Deprecated name, use `McpToolset` instead."""

def __init__(self, *args, **kwargs):
warnings.warn(
"MCPToolset class is deprecated, use `McpToolset` instead.",
DeprecationWarning,
stacklevel=2,
)
super().__init__(*args, **kwargs)


class McpToolsetConfig(BaseToolConfig):
"""The config for MCPToolset."""

stdio_server_params: Optional[StdioServerParameters] = None
Expand Down
Loading