Deprecate McpErrorCode.ResourceNotFound (-32002) and use McpErrorCode.InvalidParams (-32602) per SEP-2164#1558
Open
jayaraman-venkatesan wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
…rceNotFound (-32002) and use InvalidParams (-32602) per SEP-2164
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1540
SEP-2164 standardizes the error code for "resource not found" from the MCP-specific
-32002to the standard JSON-RPC-32602(Invalid Params), as part of the 2026-06-30 MCP spec release.How Has This Been Tested?
dotnet test) — no new tests were needed since the existing resource routing, resource builder, and exception propagation tests already cover the error code path; their assertions were updated to expect-32602.Breaking Changes
McpErrorCode.ResourceNotFoundis marked[Obsolete]but retained at its original value-32002for backward compatibility with pre-2026-06-30 clients and servers that may still send or check for that code. New code should useMcpErrorCode.InvalidParams(-32602).Server implementors who currently throw
McpErrorCode.ResourceNotFoundwill see a compiler warning directing them to migrate toMcpErrorCode.InvalidParams.Types of changes
Checklist
Additional context
McpErrorCode.ResourceNotFound = -32002is marked[Obsolete]with a message pointing toInvalidParamsReadResourcehandler inMcpServerImplnow throwsInvalidParamsMcpErrorCode.InvalidParamsdocs updated to list Resources as a covered contextInvalidParams