diff --git a/src/google/adk/tools/mcp_tool/mcp_tool.py b/src/google/adk/tools/mcp_tool/mcp_tool.py index a5b598fd81..08a1ba22a6 100644 --- a/src/google/adk/tools/mcp_tool/mcp_tool.py +++ b/src/google/adk/tools/mcp_tool/mcp_tool.py @@ -151,8 +151,16 @@ async def run_async( self, *, args: dict[str, Any], tool_context: ToolContext ) -> Any: if isinstance(self._require_confirmation, Callable): + args_to_call = args + try: + signature = inspect.signature(self._require_confirmation) + if "tool_context" in signature.parameters: + args_to_call = args.copy() + args_to_call["tool_context"] = tool_context + except (TypeError, ValueError): + pass require_confirmation = await self._invoke_callable( - self._require_confirmation, args + self._require_confirmation, args_to_call ) else: require_confirmation = bool(self._require_confirmation)