Skip to content

fix(tools): guard set_model_response as a reserved MCP tool name - #7149

Open
Sehastrajit-S wants to merge 1 commit into
google:mainfrom
Sehastrajit-S:fix-mcp-reserved-set-model-response
Open

Sehastrajit-S wants to merge 1 commit into
google:mainfrom
Sehastrajit-S:fix-mcp-reserved-set-model-response

Conversation

@Sehastrajit-S

Copy link
Copy Markdown

Summary

  • An MCP server could expose a tool literally named set_model_response, which would shadow the framework's built-in SetModelResponseTool since _RESERVED_TOOL_NAMES in mcp_tool.py never included it (unlike adk_request_confirmation, adk_request_input, adk_request_credential, and transfer_to_agent, which are all guarded).
  • Adds SET_MODEL_RESPONSE_FUNCTION_CALL_NAME as a module-level constant on SetModelResponseTool, mirroring the REQUEST_*_FUNCTION_CALL_NAME pattern in functions.py, and uses it both for the tool's own name and in the MCP reserved-name guard.

Fixes #7144

Test plan

  • Added a regression case to the existing test_init_reserved_name parametrized test in test_mcp_tool.py covering set_model_response.
  • pytest tests/unittests/tools/ (2276 passed, 2 skipped)
  • pre-commit run --files on the changed files (ruff, isort, pyink, addlicense all pass)

@google-cla

google-cla Bot commented Sep 17, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

An MCP server exposing a tool literally named set_model_response could
shadow the built-in SetModelResponseTool, since _RESERVED_TOOL_NAMES in
mcp_tool.py never accounted for it. Add the dispatch name as a shared
constant on SetModelResponseTool and register it in the reserved set,
matching how the other framework-reserved names are handled.
@Sehastrajit-S
Sehastrajit-S force-pushed the fix-mcp-reserved-set-model-response branch from 6fd91db to 6ea82ee Compare September 17, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set_model_response is missing from the MCP _RESERVED_TOOL_NAMES guard

1 participant