Repository navigation
test: snapshot the MCP tool contract and exercise registration through an in-memory server - #13
Merged
Merged
Conversation
…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.
|
🎉 This PR is included in version 3.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsonisToolRegistry.allTools()encoded with sorted keys. The newtoolContractMatchesSnapshottest compares against it and names the first differing line;UPDATE_TOOL_CONTRACT=1 swift test --filter toolContractMatchesSnapshotregenerates it. A changed snapshot in a diff is the signal that the PR title needsfeat,fixor!.ServerRegistrationTestsdrivesToolRegistry.registerHandlersthrough the SDK'sInMemoryTransportand a realClient. It pins the read-only listing and the read-only call gate end to end, which nothing reached before.inputContractsis deleted. Its substring checks are a strict subset of the snapshot.Package.swiftexcludes theContractdirectory 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 sendnulltoday.Verification
swift test: 31 library tests and 141 server tests pass (139 before, +3 new, −1 deleted).swift build -c releaseis clean.Mutation record
time filter→time filtersin the query tool descriptiontoolContractMatchesSnapshot, reported astool-contract.json:8with both linesdestructiveHintinstead ofreadOnlyHinttoolContractMatchesSnapshot,readOnlyTools,readOnlyServerBoth reverted before commit.
Release impact
None. Tests and a test-target manifest exclude only.