-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Describe the bug
The MCPToolset class inherits from BaseToolset but doesn't properly accept or handle the
tool_name_prefix parameter that is defined in the parent class constructor. This causes a TypeError when
trying to use the documented functionality.
To Reproduce
Steps to reproduce the behavior:
- Try to create an MCPToolset with tool_name_prefix parameter:
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
from google.adk.tools.mcp_tool.mcp_session_manager import SseConnectionParams
toolset = MCPToolset(
connection_params=SseConnectionParams(url="http://localhost:8000/sse"),
tool_name_prefix="my_prefix_" # This should work based on inheritance
)
2. Observe the TypeError
Expected behavior
Based on the inheritance from BaseToolset, MCPToolset should:
- Accept tool_name_prefix parameter in its constructor
- Properly initialize the parent class with this parameter
- Apply the prefix to tool names as implemented in BaseToolset.get_tools_with_prefix()
Actual behavior
- TypeError: MCPToolset.init() got an unexpected keyword argument 'tool_name_prefix'
- The super().init() call in line 124 only passes tool_filter but omits tool_name_prefix
Root cause analysis
In MCPToolset.init() (around line 124):
super().init(tool_filter=tool_filter) # Missing tool_name_prefix parameter
Should be:
super().init(tool_filter=tool_filter, tool_name_prefix=tool_name_prefix)
Environment
- google-adk version: 1.12.0
- Python version: 3.13.3
- OS: macOS Darwin 24.6.0
Current workaround
toolset = MCPToolset(connection_params=...)
toolset.tool_name_prefix = "my_prefix_" # Manual assignment after creation
Impact
This prevents proper tool naming in multi-agent scenarios where different agents need prefixed tools to
avoid naming conflicts, which is a common use case in agent orchestration systems.