Repository navigation
fix(v1): bump mcp to 2.2.0 and keep tool exception text for the model - #2982
Merged
Merged
Conversation
Bumps [mcp](https://github.com/modelcontextprotocol/python-sdk) from 2.0.0 to 2.2.0. - [Release notes](https://github.com/modelcontextprotocol/python-sdk/releases) - [Changelog](https://github.com/modelcontextprotocol/python-sdk/blob/main/RELEASE.md) - [Commits](modelcontextprotocol/python-sdk@v2.0.0...v2.2.0) --- updated-dependencies: - dependency-name: mcp dependency-version: 2.2.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
mcp 2.1 (modelcontextprotocol/python-sdk#3314) treats any exception from a tool other than ToolError/MCPError as a crash and sends the client only "Error executing tool <name>". Our tools raise to tell the model what went wrong (e.g. general-agent's "Order X not found"), so re-raise those as ToolError in the toolset wrapper, which keeps the 2.0 text exactly. Adds a tool-error integration cell: a tool that raises a stamped message, rewarded only if the stamp reaches the trace. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The integration matrix lists its files, so a new file would not run in CI. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused MCP error-propagation fix with a pinned dependency update and an integration regression test. Runtime behavior changes only to preserve unexpected tool exception text for the model, with no broader workflow or schema impact. Notes:
You can add or adjust custom eligibility rules. Learn more. |
mikasenghaas
approved these changes
Oct 26, 2026
mikasenghaas
left a comment
Member
There was a problem hiding this comment.
separate integration seems like quite a lot but sure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bumps
mcp2.0.0 → 2.2.0 (dependabot's commit from #2878, unchanged) and fixes the one behavior change in that range that silently affects our tasksets.Since mcp 2.1.0 (modelcontextprotocol/python-sdk#3314),
MCPServertreats any exception a tool raises, other thanToolError/MCPError, as a crash. The client then gets onlyError executing tool <name>, without the exception text. Our tools raise to tell the model what went wrong (an unknown id, an invalid argument), so on 2.2.0 the model would lose that feedback:ValueError("Order A-17 not found")Error executing tool lookup: Order A-17 not foundError executing tool lookupError executing tool lookup: Order A-17 not foundServerBase._with_statenow re-raises a tool's own exception asToolError, the channel upstream keeps for messages meant for the model. That keeps the 2.0 text byte-for-byte, and the server logs one INFO line instead of a traceback. This covers every@vf.tooland everyadd_tool(self._with_state(...))registration. Toolsets that replaceMCPServer.call_tooldirectly (Harbor, NeMo Gym) already kept their messages.Nothing else in 2.1/2.2 affects us:
stateless_http=True.http://host:port/mcpand don't redirect.mcp==2.0.0pin, so they are unchanged here.Supersedes #2878.
Testing
test_tool_errorintests/integration/test_multi_turn_tool.py(tool-errorfixture, runs in the Multi-Turn Tool job): the tool always raises a stamped message, and the reward is 1.0 only if the stamp reaches the trace. It fails on the bump alone (the tool message isError executing tool lookup) and passes with the fix.test_toolnull-in-prime, plustest_tool_placementwith the tool colocated, in a Compose service, as a subprocess, and on its own Prime VM)test_stateful_tooltest_shared_tooltests/unit, ruff, ty🤖 Generated with Claude Code
Note
Medium Risk
Touches MCP tool error handling on every state-wrapped tool path; behavior is intentional but changes what clients see for unexpected exceptions versus true server crashes.
Overview
Upgrades
mcpfrom 2.0.0 to 2.2.0 and restores behavior where tool exception messages reach the model. On MCP 2.1+, non-ToolError/MCPErrorfailures are surfaced to clients as a generic “Error executing tool …” without the original message; task tools often raiseValueError(etc.) so the model can recover.ServerBase._with_stateinverifiers/v1/mcp/server.pynow catches exceptions from wrapped tool calls and re-raises them asToolError(str(e)), while leaving existingToolError/MCPErrorunchanged—so@vf.tooland state-wrapped registrations keep the prior error text.Adds integration coverage:
tool-errorfixture (tests/integration/fixtures/tool_error.py) with a reward that checks a secret token appears in tool messages, plustest_tool_errorintest_multi_turn_tool.py.Reviewed by Cursor Bugbot for commit ef809b5. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Keep tool exception text for the model in
ServerBasetool calls and bump MCP to 2.2.0ToolErrorresults carrying the exception text; existingToolErrorandMCPErrorare re-raised unchanged.tool_errorintegration fixture and test in test_multi_turn_tool.py that gives full reward when the exception text reaches the recorded tool messages.ToolErrorresults instead; state sync only runs after successful execution.Macroscope summarized ef809b5.