pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/modelcontextprotocol/python-sdk/pull/2372

8641c0a1f3e0.css" /> Return METHOD_NOT_FOUND for invalid request methods by raashish1601 · Pull Request #2372 · modelcontextprotocol/python-sdk · GitHub
Skip to content

Return METHOD_NOT_FOUND for invalid request methods#2372

Open
raashish1601 wants to merge 1 commit intomodelcontextprotocol:mainfrom
raashish1601:contributor-26/python-sdk-1561
Open

Return METHOD_NOT_FOUND for invalid request methods#2372
raashish1601 wants to merge 1 commit intomodelcontextprotocol:mainfrom
raashish1601:contributor-26/python-sdk-1561

Conversation

@raashish1601
Copy link
Copy Markdown

Fixes #1561.

Summary

  • return METHOD_NOT_FOUND for unknown JSON-RPC request methods instead of collapsing them into the generic request-validation INVALID_PARAMS fallback
  • keep INVALID_PARAMS for malformed known methods by only special-casing method names that are outside the typed client request union
  • add a focused regression proving invalid/method returns -32601 while malformed initialize still returns -32602

Testing

  • PYTHONPATH=src python -m pytest -o addopts="" tests/issues/test_1561_invalid_method_names.py -q
  • python -m ruff check src/mcp/shared/session.py src/mcp/server/session.py tests/issues/test_1561_invalid_method_names.py
  • git diff --check

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.

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

1 participant

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy