Skip to content

mcp: align resource not found error code with sep-2164#931

Merged
yarolegovich merged 3 commits intomainfrom
yarolegovich/resnotfound-errorcode
May 5, 2026
Merged

mcp: align resource not found error code with sep-2164#931
yarolegovich merged 3 commits intomainfrom
yarolegovich/resnotfound-errorcode

Conversation

@yarolegovich
Copy link
Copy Markdown
Member

Change the error code returned by ResourceNotFoundError from -32002 to -32602 (jsonrpc.CodeInvalidParams), aligning with SEP-2164.

  • Not gated with a protocol version check, because the previous error code was never formally specified and the behaviour varied across SDKs.
  • In case clients which rely on the old error code exist, the previous behaviour can be restored with MCPGODEBUG=customresnotfounderrcode=1.
  • CodeResourceNotFound deprecated since its only purpose going forward is backward compatibility. The new code should use jsonrpc.CodeInvalidParams directly.
  • CodeResourceNotFound changed to var so it can stay in sync with ResourceNotFoundError and existing code doing code == mcp.CodeResourceNotFound keeps working in both the default and compat modes.

@yarolegovich yarolegovich requested a review from maciej-kisiel May 4, 2026 17:22
Comment thread docs/mcpgodebug.md
@yarolegovich yarolegovich requested a review from maciej-kisiel May 5, 2026 13:56
@yarolegovich yarolegovich merged commit 2b7c993 into main May 5, 2026
10 checks passed
@yarolegovich yarolegovich deleted the yarolegovich/resnotfound-errorcode branch May 5, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants