Skip to content

Commit 15afe99

Browse files
committed
fix(mcp): Restore McpTool.__init__ body and fix method name during rebase
- Restore missing __init__ method body that was lost during rebase - Add proper instance variable initialization (_mcp_tool, _mcp_session_manager, _require_confirmation, _header_provider, _progress_callback) - Rename get_function_declaration to _get_declaration with @OverRide decorator to match upstream convention This fixes test failures in test_mcp_toolset.py where tests expect _progress_callback attribute on McpTool instances.
1 parent 2b94203 commit 15afe99

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/google/adk/tools/mcp_tool/mcp_tool.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,27 @@ def __init__(
166166
The factory receives (tool_name, callback_context, **kwargs) and
167167
returns a ProgressFnT or None. This allows callbacks to access
168168
and modify runtime context like session state.
169+
170+
Raises:
171+
ValueError: If mcp_tool or mcp_session_manager is None.
172+
"""
173+
super().__init__(
174+
name=mcp_tool.name,
175+
description=mcp_tool.description if mcp_tool.description else "",
176+
auth_config=AuthConfig(
177+
auth_scheme=auth_scheme, raw_auth_credential=auth_credential
178+
)
179+
if auth_scheme
180+
else None,
181+
)
182+
self._mcp_tool = mcp_tool
183+
self._mcp_session_manager = mcp_session_manager
184+
self._require_confirmation = require_confirmation
185+
self._header_provider = header_provider
186+
self._progress_callback = progress_callback
187+
188+
@override
189+
def _get_declaration(self) -> FunctionDeclaration:
169190
"""Gets the function declaration for the tool.
170191
171192
Returns:

0 commit comments

Comments
 (0)