Skip to content

test: snapshot the MCP tool contract and exercise registration through an in-memory server - #13

Merged
k3KAW8Pnf7mkmdSMPHz27 merged 1 commit into
mainfrom
test/tool-contract-golden
Oct 3, 2026
Merged

k3KAW8Pnf7mkmdSMPHz27 merged 1 commit into
mainfrom
test/tool-contract-golden

Conversation

@k3KAW8Pnf7mkmdSMPHz27

Copy link
Copy Markdown
Owner

First of the refactoring series: the instruments that let every later PR prove it changed nothing a client can see.

Change

  • Tests/EventKitMCPTests/Contract/tool-contract.json is ToolRegistry.allTools() encoded with sorted keys. The new toolContractMatchesSnapshot test compares against it and names the first differing line; UPDATE_TOOL_CONTRACT=1 swift test --filter toolContractMatchesSnapshot regenerates it. A changed snapshot in a diff is the signal that the PR title needs feat, fix or !.
  • ServerRegistrationTests drives ToolRegistry.registerHandlers through the SDK's InMemoryTransport and a real Client. It pins the read-only listing and the read-only call gate end to end, which nothing reached before.
  • inputContracts is deleted. Its substring checks are a strict subset of the snapshot.
  • Package.swift excludes the Contract directory from the test target so SwiftPM does not warn about an unhandled file.

The snapshot also settles a question for later work: every optional input property is already advertised as ["<type>", "null"], so clients may send null today.

Verification

  • swift test: 31 library tests and 141 server tests pass (139 before, +3 new, −1 deleted).
  • swift build -c release is clean.

Mutation record

Mutation Failing tests
time filter → time filters in the query tool description toolContractMatchesSnapshot, reported as tool-contract.json:8 with both lines
overview declared destructiveHint instead of readOnlyHint toolContractMatchesSnapshot, readOnlyTools, readOnlyServer

Both reverted before commit.

Release impact

None. Tests and a test-target manifest exclude only.

…h an in-memory server

Every client-observable change to the five tools (name, title, description,
annotations, input and output schema) now shows up as a JSON diff in the PR
that makes it, which is what the PR title has to be decided from.
@k3KAW8Pnf7mkmdSMPHz27
k3KAW8Pnf7mkmdSMPHz27 merged commit 019b8ed into main Oct 3, 2026
3 checks passed
@k3KAW8Pnf7mkmdSMPHz27
k3KAW8Pnf7mkmdSMPHz27 deleted the test/tool-contract-golden branch October 3, 2026 01:44
@eventkit-tap-bumper

Copy link
Copy Markdown

🎉 This PR is included in version 3.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

1 participant