Skip to content

Fix isJsonRpcError mis-classifying {result,error:null} + envelope check (110->124) - #11

Merged
madetocreate merged 1 commit into
mainfrom
oss-improve/coverage-and-spec
Jun 21, 2026
Merged

Fix isJsonRpcError mis-classifying {result,error:null} + envelope check (110->124)#11
madetocreate merged 1 commit into
mainfrom
oss-improve/coverage-and-spec

Conversation

@madetocreate

Copy link
Copy Markdown
Contributor

What

Conformance-harness correctness + coverage. Spec checked against current MCP 2025-11-25 via context7 (already supported correctly).

  • Correctness bug: isJsonRpcError() (used by every suite) used "error" in response, so the common {result, error: null} success shape was misclassified as an error -> spurious FAIL/WARN for conformant servers. Tightened to require a non-null error object with a numeric code.
  • New jsonrpc-response-envelope check (result/error mutual exclusivity).
  • Migrated vitest config off the removed v4 poolOptions.
  • +14 tests.

Tests 110 -> 124. Version 0.2.0 -> 0.2.1. No publish in this PR.

…0.2.1)

The shared isJsonRpcError() classifier used a bare `"error" in response`
test, which misclassifies the `{ jsonrpc, id, result, error: null }` shape
— a common serialiser default — as an error. That turned passing tool
roundtrips into spurious FAIL/WARN across the smoke/schema/capability/
version suites. A wrong conformance verdict is worse than a missing check.

Per JSON-RPC 2.0 §5 and the MCP `Error` interface, an error response carries
an `error` member that is an object with a numeric `code`; a success response
carries `result` and omits `error`. isJsonRpcError() now enforces exactly
that, matching the HTTP adapter's own envelope detection (verified against
the current spec via context7 /websites/modelcontextprotocol_io_specification_2025-11-25).

Also adds a `jsonrpc-response-envelope` check (result/error mutual
exclusivity — no prior suite caught `{ result, error: {...} }`), migrates
vitest.config off the removed-in-v4 nested poolOptions, and bumps to 0.2.1.

Tests: +tests/jsonrpc-helpers.test.ts (10 cases) + hybrid-envelope-server
fixture + 4 integration tests proving error:null is treated as success by
smoke/schema yet warned by the envelope check. 110 -> 124 tests, all green.
build + tsc --strict clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@madetocreate
madetocreate merged commit 37acfea into main Jun 21, 2026
3 checks passed
@madetocreate
madetocreate deleted the oss-improve/coverage-and-spec branch June 21, 2026 16:32
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.

2 participants