Conversation
…LID_PARAMS A POST body that parsed as JSON but was not a JSON-RPC message was answered with -32602 (INVALID_PARAMS). There are no params to be invalid in that case, so JSON-RPC 2.0 reserves -32600 (INVALID_REQUEST) for it; -32602 misreports the failure to the client. This is the first of the two shapes in modelcontextprotocol#3557. The second shape (an unknown method answered with INVALID_PARAMS) no longer reproduces on main: request parsing moved from shared/session.py's receive loop to shared/jsonrpc_dispatcher.py, and server/runner.py answers an unknown method with METHOD_NOT_FOUND. A batch body (a JSON array) keeps INVALID_PARAMS, pinned by the hosting conformance test for unsupported batch bodies; modelcontextprotocol#3557's case is the non-Request object body. Fixes modelcontextprotocol#3557
|
This PR has been closed automatically. This repo only keeps pull requests open when they come from a maintainer, or from a contributor a maintainer has assigned to the linked issue, and you aren't currently assigned to #3557. If a maintainer assigns you to #3557, this PR reopens on its own and there's nothing more you need to do here. Assignment is a maintainer call based on capacity; comments that only ask to be assigned don't factor in. What does help is engaging on the issue itself by confirming the repro, explaining why it matters for your use case, or describing the approach you'd take. You're welcome to keep pushing commits here (just avoid force-pushing, since GitHub can't reopen a rewritten branch), but that on its own won't get the PR reviewed or the issue assigned, and realistically most auto-closed PRs stay closed. There's no need to open a new PR either way. CONTRIBUTING.md has the full reasoning, but in short:
Maintainers: reopen, remove |
Fixes #3557
Motivation and Context
A POST body that parsed as JSON but was not a JSON-RPC message was answered with -32602 (INVALID_PARAMS). There are no params to be invalid in that case, so JSON-RPC 2.0 reserves -32600 (INVALID_REQUEST) for it; -32602 misreports the failure to the client. This is the first of the two shapes in #3557.
The second shape (an unknown method answered with INVALID_PARAMS instead of METHOD_NOT_FOUND) no longer reproduces on main: request parsing moved from
shared/session.py's receive loop toshared/jsonrpc_dispatcher.py, andserver/runner.pyanswers an unknown method withMETHOD_NOT_FOUND, so no change was needed there.A batch body (a JSON array) keeps INVALID_PARAMS: the hosting conformance test
test_malformed_and_batched_bodies_return_400pins that code for unsupported batch bodies, and #3557's case is the non-Request object body.How Has This Been Tested?
test_non_request_body_is_invalid_request(tests/shared/test_streamable_http.py): a{"foo": "bar"}body returns 400 with -32600; a batch array still returns 400 with -32602.uv run --frozen pytest→ 5961 passed, 16 skipped, 1 xfailed, 0 failed.ruff check/ruff format --checkclean; pyright unchanged (34 pre-existing Windows-only diagnostics, same as unpatched main).Breaking Changes
Clients keying on -32602 for a non-Request body will now see -32600, which is what the spec requires. The HTTP status and the message text are unchanged.
Types of changes
Checklist
help wanted, or I'm a maintainer) — not assigned yetAI disclosure: the diff was written with the ZCode agent; I reproduced the -32602 response with a test before the change, ran the full suite and linters locally, and verified the batch-body behavior the existing conformance test pins.