Skip to content

Cover the MCP metadata tools and transport edges (closes #83, closes #85) - #112

Merged
kikashy merged 1 commit into
mainfrom
mcp-metadata-and-transport
Aug 15, 2026
Merged

Cover the MCP metadata tools and transport edges (closes #83, closes #85)#112
kikashy merged 1 commit into
mainfrom
mcp-metadata-and-transport

Conversation

@kikashy

@kikashy kikashy commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Closes #83. Closes #85.

Both issues change internal/mcp/server_test.go, so they land together rather than conflicting in one file.

The metadata tools (#83)

Each success case asserts what makes the response useful, not that a response arrived:

  • get_schemasha256 and bytes must describe the schema text actually served. A digest that does not describe its payload is worse than no digest, because a caller pins against it. The served text is also asserted to be valid JSON.
  • describe_runtime — identifies itself, lists supported versions, states artifact provenance — and its claimed versions must include the one get_schema really serves. Two payloads that disagree would otherwise both pass.
  • test_conformance — the bundled corpus passes against its own runtime, with passed == total and the corpus digest and target version named.

Bad arguments are asserted to be tool errors inside successful JSON-RPC responses, never top-level protocol errors — the distinction that lets a client tell "your call was wrong" from "the transport broke".

The transport table (#85)

Pins what must and must not produce a response: parse error with a null id, blank and whitespace-only lines skipped, ping, the default protocol version, notifications and unknown notifications answered with nothing, and a valid request still processed after a malformed line.

Two mutations that initially did nothing

Worth recording, because the tests reported ok and that proved nothing:

Mutation First attempt Why
notification answers no-op reply() already returns false whenever a message has no id — breaking it requires bypassing reply entirely
get_schema digest wrong no-op had to corrupt the metadata after describe.Schema, not at the call site

Redone so they actually take effect, both fail correctly:

got 1 responses, want 0: [{"id":null,"jsonrpc":"2.0","result":{}}]
sha256 = "deadbeef", but the served bytes hash to "c65c559d..."

Ending the stream on a malformed line also fails, as it should.

Payload shapes read, not guessed

My first version asserted a schema field and an artifacts array that do not exist. I read the real payloads from a live server and rewrote against the actual contract — the schema text arrives as tool content, and provenance is a single artifactProvenance string.

go test ./internal/mcp and go test ./... pass; gofmt clean. Test file only.

🤖 Generated with Claude Code

)

Both issues change server_test.go, so they land together rather than
conflicting in one file.

The three read-only metadata tools had no coverage through the stdio harness.
Each success case asserts what makes the response useful rather than that a
response arrived: get_schema's sha256 and bytes must describe the schema text
actually served, not some other copy — a digest that does not describe the
payload is worse than none, because a caller pins against it — describe_runtime
must identify itself, list versions and state artifact provenance, and its
claimed versions must include the one get_schema really serves. Bad arguments
are asserted to be tool errors inside SUCCESSFUL JSON-RPC responses, which is
what lets a client tell "your call was wrong" from "the transport broke".

The transport table pins what must and must NOT produce a response: a parse
error carrying a null id, blank and whitespace-only lines skipped, ping, the
default protocol version, notifications and unknown notifications answered with
nothing, and a valid request still processed after a malformed line.

Three claims mutation-checked, and two of the three mutations initially did
nothing while the tests reported ok — which proves nothing about the tests. The
notification mutation was a genuine no-op because reply() already returns false
whenever a message has no id, so breaking it requires bypassing reply
altogether; redone that way it fails. Likewise the digest mutation had to
corrupt the metadata after describe.Schema rather than at the call site. Both
fail correctly once they actually take effect, as does ending the stream on a
malformed line.

Payload shapes were read from a live server rather than guessed: my first
version asserted a schema field and an artifacts array that do not exist.

Signed-off-by: kikashy <kikashy@hotmail.com>
@kikashy
kikashy force-pushed the mcp-metadata-and-transport branch from 8d0f634 to e1f39b9 Compare August 15, 2026 01:05
@kikashy
kikashy merged commit 396f887 into main Aug 15, 2026
6 checks passed
@kikashy
kikashy deleted the mcp-metadata-and-transport branch August 15, 2026 01:06
@github-actions

Copy link
Copy Markdown

🎉 Thank you for your contribution to Judgment Pack!

If you’d like another task, choose a path that interests you:

kikashy added a commit that referenced this pull request Aug 15, 2026
PR #110 covered the same stdio transport cases as #112 and was opened 43
minutes earlier. #112 merged first, which was my error: issue #85 carried no
assignee and no comment, and I read the issue list without checking whether an
open PR already closed it.

One assertion in #110 is better than the one that merged. It checks that ping
returns an EMPTY result object; #112 only checked that the id was echoed. An
echoed id shows that something answered, so a ping returning a payload passes
that check and is still wrong. Verified: making ping return {"pong": true} is
caught by this assertion and was not caught before.

Landing it here so the credit is a merged commit rather than an offer.

Signed-off-by: kikashy <kikashy@hotmail.com>
Co-authored-by: Bo Zhang <187063395+Tethys0@users.noreply.github.com>
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.

Add MCP transport edge-case tests Test the read-only MCP metadata tools end to end

1 participant