Repository navigation
Conversation
An MCP tool failure is a normal JSON-RPC result with `isError: true` and the error text in `content`. The MCP node only read `content`, so a failed tool call looked like a successful node: the run kept going and downstream nodes received the error text as `result`. Raise the tool error instead, so the run stops or takes the node's exception branch like every other failing node. Refs 1Panel-dev#7844
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.
What this PR does / why we need it?
Fixes #7844.
An MCP tool that fails returns a normal JSON-RPC result with
isError: trueand the error text incontent(that is what FastMCP does for a raised tool exception).BaseMcpNode.executeonly readcontent, so the node never raised: the workflow kept running with node status 200 and downstream nodes received the error text through{{MCP node.result}}as if the tool had succeeded.Summary of your change
apps/application/flow/step_node/mcp_node/impl/base_mcp_node.py: afterSandboxMCPBackend.call_tool, raise when the result hasisErrorset, carrying the tool name and the text content. This uses the same failure path as the other nodes, so the run stops or takes the node exception branch.apps/application/test_mcp_node.py: new standalone tests (same pattern astest_reranker_node.py, no database) for the error result, an error result without text content, and an unchanged successful result.Verification
python -m unittest apps.application.test_mcp_node→ 3 passed.v2(2900bd8) and pass with this change; the success test passes on both.SANDBOX=1worker path (it returns the sameCallToolResult), and the UI exception-branch wiring formcp-node.AI assistance: the change and tests were written with an AI coding agent; I ran the tests above and reviewed the diff.
Please indicate you have done the following: