Commit 979f326
committed
fix: skip output schema validation when tool returns is_error=True
When a tool with an inferred output_schema returns
CallToolResult(is_error=True), the SDK's convert_result() calls
model_validate(None) unconditionally, raising a pydantic error that
replaces the intended error message.
Skip output schema validation when the result signals an error,
matching the TypeScript SDK fix (modelcontextprotocol/typescript-sdk#655).
Fixes #24291 parent 3d7b311 commit 979f326
File tree
2 files changed
+27
-2
lines changed- src/mcp/server/mcpserver/utilities
- tests/server/mcpserver
2 files changed
+27
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
878 | 903 | | |
879 | 904 | | |
880 | 905 | | |
| |||
0 commit comments