Fix the SDK vs Spec types test that is breaking CI#908
Merged
felixweinberger merged 3 commits intomodelcontextprotocol:mainfrom Aug 29, 2025
Merged
Fix the SDK vs Spec types test that is breaking CI#908felixweinberger merged 3 commits intomodelcontextprotocol:mainfrom
felixweinberger merged 3 commits intomodelcontextprotocol:mainfrom
Conversation
- Omit spec.types.test.ts for now unti we can figure out how to make it work. - Changes in the spec file are causing it to fail vis-à-vis JSONRPCNotification vs Notification - see modelcontextprotocol/modelcontextprotocol#1026
- Remove the previous ommision of spec.types.test.ts * In spec.types.test.ts - Added two types WithJSONRPC<T> and WithJSONRPCRequest<T> - in test function arguments for notifications, make sdk argument type wrapped by WithJSONRPC - in test function arguments for requests, make sdk argument type wrapped by WithJSONRPCRequest - Add 'Error' to MISSING_SDK_TYPES array (inner error object of a JSONRPCError) - Adjusted specTypes length check to match current actual length (92)
felixweinberger
approved these changes
Aug 29, 2025
Comment on lines
+24
to
+29
| // Adds the `jsonrpc` property to a type, to match the on-wire format of notifications. | ||
| type WithJSONRPC<T> = T & { jsonrpc: "2.0" }; | ||
|
|
||
| // Adds the `jsonrpc` and `id` properties to a type, to match the on-wire format of requests. | ||
| type WithJSONRPCRequest<T> = T & { jsonrpc: "2.0"; id: SDKTypes.RequestId }; | ||
|
|
Contributor
There was a problem hiding this comment.
This seems like a reasonable approach matching the other generics here to bridge the gap between SDK types and the JSONRPC types.
Contributor
|
Thanks for fixing this! |
9 tasks
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.
Description
spec.types.test.tsWithJSONRPC<T>andWithJSONRPCRequest<T>sdkargument type wrapped byWithJSONRPCsdkargument type wrapped byWithJSONRPCRequestErrortoMISSING_SDK_TYPESarray (inner error object of aJSONRPCError)specTypeslength check to match current actual length (92)Motivation and Context
Tl;dr
A recent set of changes to the
schema.tsfile in the specification repo has broken a test in this repo which checks that our types all match the spec. This causes CI to fail and no further PRs can be merged until this is fixed.The core issue stemmed from a deliberate design choice in the SDK: internal types for requests and notifications omit the
jsonrpcandidproperties for cleaner internal handling, while the specification-generated types define the full on-the-wire format, which includes them.This PR fixes that by addressing the mismatch with two helper types that wrap SDK types before comparing them to spec types.
Here's what happened:
src/spec.types.test.tssimilar to:src/spec.types.tst.tsfile, I replaced my version of it from local history removed thenpm run fetch:spec-typesfrom thetestnpm script and ran it. All passed.After further sleuthing with @felixweinberger in this Discord thread, we narrowed it down to this PR in the specification repo.
The author of the spec repo PR, @hesreallyhim did some looking into it last night and his response was:
How Has This Been Tested?
All tests now run locally:

This is the first PR since the problem occured that passes CI
Breaking Changes
Nope.
Types of changes
Checklist
Additional context