Skip to content

fix(server): return -32602 for resource not found (SEP-2164) - #2344

Closed
pja-ant wants to merge 7 commits into
mainfrom
feat/sep-2164-resource-not-found-error-code
Closed

fix(server): return -32602 for resource not found (SEP-2164)#2344
pja-ant wants to merge 7 commits into
mainfrom
feat/sep-2164-resource-not-found-error-code

chore(server): address review nits on resource error handling

6bc310e
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Apr 30, 2026 in 14m 40s

Code review found 1 potential issue

Found 5 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/mcp/server/mcpserver/server.py:452-455 MCPServer.read_resource() docstring missing Raises: section

Annotations

Check warning on line 455 in src/mcp/server/mcpserver/server.py

See this annotation in the file changed.

@claude claude / Claude Code Review

MCPServer.read_resource() docstring missing Raises: section

Nit: per AGENTS.md ("When a public API raises exceptions a caller would reasonably catch, document them in a `Raises:` section"), `MCPServer.read_resource()`'s docstring should document `ResourceNotFoundError` and `ResourceError`. This PR removed the try/except wrap so the method now propagates `ResourceNotFoundError` directly, and added `Raises:` sections to both `ResourceManager.get_resource()` and `ResourceTemplate.create_resource()` — but left this one, the most user-facing of the three, wit