fix(client): skip output schema validation on error results#1428
fix(client): skip output schema validation on error results#1428codefromthecrypt wants to merge 1 commit intomodelcontextprotocol:v1.xfrom
Conversation
Signed-off-by: Adrian Cole <adrian@tetrate.io>
|
commit: |
|
@cliffhall if you have a chance to take a look. this is subtle but breaks ability to see tool errors in MCP inspector. For example, the jetbrains MCP server will fail with a nice reason why, but we can't see it. note I targeted this to 1.x as that is what inspector uses, but can raise another for main. |
@codefromthecrypt Code looks good, but could you throw some before & after screenshots into the description? |
|
@cliffhall fully inventoried for your approval! |
Ok, looking at your error screenshot, I have to ask why you have an The situation we have here with
There is no caveat that clients can skip validation if the result is an error. That's probably because it is a condition that doesn't make sense. |
|
@cliffhall to be clear I was unable to use MCP inspector to debug a problem because the schema was being applied to what I understand is an incorrect interpretation of the spec. Given I don't own the server and MCP inspector is a tool to use to help troubleshoot servers, what do you recommend? basically at the moment, I will see no info at all. Is there another way out or should folks use a different proxy when there are potential mismatches to diagnose? |
|
nevermind I will follow-up here as it is the exact concern, and cite this as reason to move the SEP forward modelcontextprotocol/modelcontextprotocol#2145 |


Motivation and Context
The MCP Inspector client failed tool calls that returned
isError: truealongsidestructuredContent, because the SDK still validated the output schema even on error results.How Has This Been Tested?
new tests and manual
Breaking Changes
None.
Types of changes
Checklist
Additional context
Verified with MCP inspector against IntelliJ
Found the port of IntelliJ with MCP server enabled (Note: HTTP Streamable isn't default yet, so this is SSE)
MCP inspector against IntelliJ before this fix
Tried the CLI
$ npx @modelcontextprotocol/inspector \ http://127.0.0.1:64344/sse \ --cli \ --method tools/call \ --tool-name get_repositories Failed to call tool get_repositories: MCP error -32602: Structured content does not match the tool's output schema: data must have required property 'roots' Failed with exit code: 1Tried the UI
MCP inspector against IntelliJ after this fix
Installation
Patching all inspector package.json like so:
"dependencies": { - "@modelcontextprotocol/sdk": "^1.25.2", + "@modelcontextprotocol/sdk": "file:../../typescript-sdk",Applied like this:
Tried the CLI and it works as you can see the user error missing the projectPath, which is friendly due to showing valid choices:
Tried the UI and it shows valid error choices (relies on an inspector bug to fully correct the UI)
MCP inspector follow-up
Inspector has a bug here which will be fixed once this PR is merged and released as a part of modelcontextprotocol/inspector#1045