Skip to content

[Schema] SEP-2164: Switch resource-not-found error code to -32602 with protocol-version-aware fallback #359

@chr-hertel

Description

@chr-hertel

Implements SEP-2164 for the MCP Spec 2026-07-28 release.

Tracked by umbrella #337.

Spec summary

Resource-not-found now uses JSON-RPC -32602 (Invalid Params) instead of the MCP-custom -32002, aligning with JSON-RPC.

PHP SDK changes

  • src/Schema/JsonRpc/Error.php:37 defines RESOURCE_NOT_FOUND = -32002. Change to -32602, or deprecate the constant and add RESOURCE_NOT_FOUND_INVALID_PARAMS = -32602.
  • Error::forResourceNotFound() (line ~109) is called from ReadResourceHandler, ResourceSubscribeHandler, ResourceUnsubscribeHandler, GetPromptHandler, CompletionCompleteHandler — all flip automatically once the constant changes.
  • Negotiate by protocol version: pre-2026-07-28 clients still expect -32002. Add version-aware dispatch in Error::forResourceNotFound() reading session/request protocol version.
  • Update conformance & unit tests asserting the old code.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    2026-07-28All issues and PRs related to the spec release 2026-07-28SchemaIssues & PRs related to the Schema componentenhancementRequest for a new feature that's not currently supportedimproves spec complianceImproves consistency with other SDKs such as TyepScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions