Skip to content
Open
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
10 changes: 9 additions & 1 deletion src/google/adk/tools/mcp_tool/mcp_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down