Skip to content

Commit 6d4a06f

Browse files
authored
fix(SEP-2575): introduce a custom error code for unsupported protocol error
1 parent a026bb2 commit 6d4a06f

7 files changed

Lines changed: 29 additions & 8 deletions

File tree

docs/seps/2575-stateless-mcp.mdx

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/specification/draft/basic/lifecycle.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ listing the versions it does support:
6868
"jsonrpc": "2.0",
6969
"id": 1,
7070
"error": {
71-
"code": -32602,
71+
"code": -32004,
7272
"message": "Unsupported protocol version",
7373
"data": {
7474
"supported": ["DRAFT-2026-v1", "2025-11-25"],

docs/specification/draft/schema.mdx

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/draft/examples/UnsupportedProtocolVersionError/unsupported-version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"jsonrpc": "2.0",
33
"id": 1,
44
"error": {
5-
"code": -32602,
5+
"code": -32004,
66
"message": "Unsupported protocol version",
77
"data": {
88
"supported": ["DRAFT-2026-v1", "2025-11-25"],

schema/draft/schema.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/draft/schema.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,14 @@ export interface InternalError extends Error {
361361
*/
362362
export const MISSING_REQUIRED_CLIENT_CAPABILITY = -32003;
363363

364+
/**
365+
* Error code returned when the request's protocol version is not supported
366+
* by the server.
367+
*
368+
* @category Errors
369+
*/
370+
export const UNSUPPORTED_PROTOCOL_VERSION = -32004;
371+
364372
/**
365373
* Returned when the request's protocol version is unknown to the server or
366374
* unsupported (e.g., a known experimental or draft version the server has
@@ -377,7 +385,7 @@ export interface UnsupportedProtocolVersionError extends Omit<
377385
"error"
378386
> {
379387
error: Error & {
380-
code: typeof INVALID_PARAMS;
388+
code: typeof UNSUPPORTED_PROTOCOL_VERSION;
381389
data: {
382390
/**
383391
* Protocol versions the server supports. The client should choose a

seps/2575-stateless-mcp.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,14 @@ return a JSON-RPC error response. For HTTP, the response status code MUST be
171171
`400 Bad Request`. The error MUST conform to the following structure:
172172

173173
```ts
174+
export const UNSUPPORTED_PROTOCOL_VERSION = -32004;
175+
174176
export interface UnsupportedProtocolVersionError extends Omit<
175177
JSONRPCErrorResponse,
176178
"error"
177179
> {
178180
error: Error & {
179-
code: typeof INVALID_PARAMS;
181+
code: typeof UNSUPPORTED_PROTOCOL_VERSION;
180182
data: {
181183
/**
182184
* An array of protocol version strings that the server supports.

0 commit comments

Comments
 (0)