Commit 65f5f72
User
fix: throw ProtocolError as JSON-RPC error for tool not found
Per MCP spec, calling a nonexistent tool should return a JSON-RPC Error
(code -32602), not a JSON-RPC Result with isError: true.
Previously, only UrlElicitationRequired errors were re-thrown; all other
ProtocolErrors (including tool/disabled checks) were swallowed and wrapped
in a CallToolResult. Now all ProtocolErrors propagate as JSON-RPC errors,
which is the correct behavior per the specification.
Fixes #15101 parent c4ee360 commit 65f5f72
File tree
2 files changed
+13
-20
lines changed- packages/server/src/server
- test/integration/test/server
2 files changed
+13
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1837 | 1837 | | |
1838 | 1838 | | |
1839 | 1839 | | |
1840 | | - | |
1841 | | - | |
1842 | | - | |
1843 | | - | |
1844 | | - | |
1845 | | - | |
1846 | | - | |
1847 | | - | |
1848 | | - | |
1849 | | - | |
1850 | | - | |
1851 | | - | |
1852 | | - | |
| 1840 | + | |
| 1841 | + | |
1853 | 1842 | | |
1854 | | - | |
1855 | | - | |
1856 | | - | |
1857 | | - | |
1858 | | - | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
1859 | 1851 | | |
1860 | 1852 | | |
1861 | 1853 | | |
| |||
0 commit comments