Skip to content

Invalid method names return error code -32602 instead of -32601 #1561

Closed

Description

@corv89

Initial Checks

Description

How to reproduce:

echo '{"jsonrpc":"2.0","method":"invalid/method","id":1,"params":{}}' | your-mcp-server

Expected result:

{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found"}}

Actual result:

{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"Invalid request parameters","data":""}}

The issue appears to occur because request validation in mcp/shared/session.py (lines 360-375) catches the validation exception and returns -32602 before the proper method-not-found handler in mcp/server/lowlevel/server.py (lines 716-718) can be reached.

Example Code

Python & MCP Python SDK

**Environment:**
- Python SDK version: `1.2.0`
- Python version: `3.12`
- Platform: macOS

Activity

  1. added
    needs confirmation
    P3
    on Nov 4, 2025
  2. added
    improves spec compliance
    and removed on Nov 12, 2025
  3. giskard09 commented on Mar 26, 2026

    @giskard09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3improves spec complianceneeds confirmation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions