diff --git a/src/google/adk/tools/mcp_tool/mcp_tool.py b/src/google/adk/tools/mcp_tool/mcp_tool.py index 09c4c9fe33..e77bbf475f 100644 --- a/src/google/adk/tools/mcp_tool/mcp_tool.py +++ b/src/google/adk/tools/mcp_tool/mcp_tool.py @@ -54,6 +54,7 @@ # part of the ADK public API; consumers flip the env var, not the symbol. from .._gemini_schema_util import _to_gemini_schema from ..base_authenticated_tool import BaseAuthenticatedTool +from ..set_model_response_tool import SET_MODEL_RESPONSE_FUNCTION_CALL_NAME from ..tool_context import ToolContext from ..transfer_to_agent_tool import transfer_to_agent from .mcp_session_manager import _http_debug_var @@ -70,6 +71,7 @@ REQUEST_EUC_FUNCTION_CALL_NAME, REQUEST_CONFIRMATION_FUNCTION_CALL_NAME, REQUEST_INPUT_FUNCTION_CALL_NAME, + SET_MODEL_RESPONSE_FUNCTION_CALL_NAME, transfer_to_agent.__name__, }) diff --git a/src/google/adk/tools/set_model_response_tool.py b/src/google/adk/tools/set_model_response_tool.py index c03392935c..140f7c8063 100644 --- a/src/google/adk/tools/set_model_response_tool.py +++ b/src/google/adk/tools/set_model_response_tool.py @@ -39,6 +39,12 @@ from .base_tool import BaseTool from .tool_context import ToolContext +# Name the framework dispatches this tool under. Exposed as a module-level +# constant (mirroring functions.py's REQUEST_*_FUNCTION_CALL_NAME) so other +# modules -- e.g. the MCP reserved-name guard -- can refer to it without +# hardcoding the literal. +SET_MODEL_RESPONSE_FUNCTION_CALL_NAME = 'set_model_response' + def _merge_json_schema_descriptions( target: dict[str, Any], source: dict[str, Any] @@ -215,7 +221,7 @@ def set_model_response() -> str: self.func = set_model_response super().__init__( - name=self.func.__name__, + name=SET_MODEL_RESPONSE_FUNCTION_CALL_NAME, description=self.func.__doc__.strip() if self.func.__doc__ else '', ) diff --git a/tests/unittests/tools/mcp_tool/test_mcp_tool.py b/tests/unittests/tools/mcp_tool/test_mcp_tool.py index 57856043ca..f7355c06e2 100644 --- a/tests/unittests/tools/mcp_tool/test_mcp_tool.py +++ b/tests/unittests/tools/mcp_tool/test_mcp_tool.py @@ -343,6 +343,7 @@ def test_init_with_empty_description(self): "adk_request_credential", "adk_request_confirmation", "adk_request_input", + "set_model_response", "transfer_to_agent", ], )