You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SEP-2164 standardizes the JSON-RPC error code returned for a "resource not found" condition. The spec moves this from the MCP-specific -32002 to the standard -32602 (INVALID_PARAMS).
Current state in rmcp
The SDK currently defines and uses -32002 (confirmed in crates/rmcp/src/model.rs):
ErrorData::resource_not_found(message, data) (line ~544) is a thin wrapper: Self::new(ErrorCode::RESOURCE_NOT_FOUND, message, data).
ErrorData carries no protocol version, and resource_not_found() is a static constructor, so the cleanest version-gating happens at the call sites (where the negotiated ProtocolVersion is known), not inside the constructor.
Proposed work
Keep ErrorCode::RESOURCE_NOT_FOUND = -32002 as a named constant for back-compat / parsing, but stop hard-coding it for new responses.
Add a helper that picks the code by negotiated version — e.g. ErrorData::resource_not_found_for(version, ..) returning -32602 for >= V_2026_07_28 and -32002 for older peers — or set the code at the resource handler call sites in handler/server/router.rs where the peer's ProtocolVersion is available.
Audit existing call sites of ErrorData::resource_not_found(..) (resource read/subscribe paths) and route them through the version-aware path.
Client side: when matching resource-not-found, accept both-32002 and -32602 (code == RESOURCE_NOT_FOUND || code == INVALID_PARAMS in the not-found context).
Small but observable change. Favor version-gating at call sites over flipping the constant, so older peers aren't broken. Confirm with the final SEP whether a hard switch at 2026-07-28 is acceptable.
Summary
SEP-2164 standardizes the JSON-RPC error code returned for a "resource not found" condition. The spec moves this from the MCP-specific
-32002to the standard-32602(INVALID_PARAMS).Current state in rmcp
The SDK currently defines and uses
-32002(confirmed incrates/rmcp/src/model.rs):ErrorCode::RESOURCE_NOT_FOUND: Self = Self(-32002)(line ~503).ErrorCode::INVALID_PARAMS: Self = Self(-32602)already exists (line ~506).ErrorData::resource_not_found(message, data)(line ~544) is a thin wrapper:Self::new(ErrorCode::RESOURCE_NOT_FOUND, message, data).ErrorDatacarries no protocol version, andresource_not_found()is a static constructor, so the cleanest version-gating happens at the call sites (where the negotiatedProtocolVersionis known), not inside the constructor.Proposed work
ErrorCode::RESOURCE_NOT_FOUND = -32002as a named constant for back-compat / parsing, but stop hard-coding it for new responses.ErrorData::resource_not_found_for(version, ..)returning-32602for>= V_2026_07_28and-32002for older peers — or set the code at the resource handler call sites inhandler/server/router.rswhere the peer'sProtocolVersionis available.ErrorData::resource_not_found(..)(resource read/subscribe paths) and route them through the version-aware path.-32002and-32602(code == RESOURCE_NOT_FOUND || code == INVALID_PARAMSin the not-found context).-32002.Affected areas
crates/rmcp/src/model.rs(ErrorCode,ErrorData::resource_not_found),handler/server/router.rs(resource handlers / call sites),service/client.rs(error interpretation).Notes / risks
2026-07-28is acceptable.-32602semantics for input validation — different concern, but worth coordinating the error-code story.