fix: skip output schema validation when tool result isError#1045
Closed
codefromthecrypt wants to merge 1 commit intomodelcontextprotocol:mainfrom
Closed
fix: skip output schema validation when tool result isError#1045codefromthecrypt wants to merge 1 commit intomodelcontextprotocol:mainfrom
codefromthecrypt wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
Author
|
draft until modelcontextprotocol/typescript-sdk#1428 is released, as there are two layers of bugs in the UI. |
Signed-off-by: Adrian Cole <adrian@tetrate.io>
d6fbce1 to
b57fc44
Compare
Author
|
Closing this out until there is a path forward the spec allows modelcontextprotocol/modelcontextprotocol#2145 |
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
When a tool returns
isError: true, itsstructuredContentis not required to conform to the tool'soutputSchema. The Inspector UI was still validating it, showing a spurious "Validation Error" that obscured the actual server-provided error message.This is the Inspector-side counterpart to modelcontextprotocol/typescript-sdk#1428, which fixes the same validation skip in the SDK's
callTool()client method.Type of Change
Changes Made
client/src/components/ToolResults.tsx— added&& !isErrorguard before callingvalidateToolOutput, matching the SDK behaviorclient/src/components/__tests__/ToolsTab.test.tsx— added test case confirming error results with non-conformingstructuredContentdo not trigger validation errorsRelated Issues
Depends on modelcontextprotocol/typescript-sdk#1428 for the SDK / CLI-level fix.
Testing
Test Results and/or Instructions
outputSchemaisError: trueresponse withstructuredContentthat doesn't match the schemaChecklist
npm run prettier-fix)Breaking Changes
None.
Additional Context
Reproduced against IntelliJ's MCP server (
get_repositoriestool) which returnsisError: truewithstructuredContentcontainingprojectsinstead of the schema-requiredroots.Before:

After:
