-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: backwards-compatible createMessage overloads for SEP-1577 #1212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+193
−13
Conversation
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
Introduce method overloading for createMessage to preserve backwards compatibility while supporting the new tools feature from SEP-1577. When called without tools, createMessage returns CreateMessageResult with single content (backwards compatible). When called with tools, it returns CreateMessageResultWithTools which allows array content. This allows existing code that doesn't use tools to continue working without any changes, while new code using tools gets the appropriate type that handles array content. Changes: - Add SamplingContentSchema for basic content types (no tool use) - Add CreateMessageResultWithToolsSchema for tool-enabled responses - Add CreateMessageRequestParamsBase/WithTools types for overloads - Add method overloads to Server.createMessage() - Update tests to use appropriate schemas - Simplify example that doesn't use tools
commit: |
85d79bc to
d3ead26
Compare
Document the intentional divergence between SDK's CreateMessageResult (single content for v1.x backwards compat) and the spec's version (array content per SEP-1577). The full array-capable type is available as CreateMessageResultWithTools. This will be aligned with schema in v2.0.
d3ead26 to
102f4a1
Compare
pcarleton
approved these changes
Dec 2, 2025
Contributor
Author
|
I also added this to the list of things to clean up for v2: #809 |
ad0ec5c to
5dca8f3
Compare
bhosmer-ant
reviewed
Dec 2, 2025
Contributor
bhosmer-ant
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you @felixweinberger - feels like the best solution given the SDK version/spec rev timelines
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.
Summary
Introduce method overloading for
createMessageto preserve backwards compatibility while supporting the new tools feature from SEP-1577.tools, returnsCreateMessageResultwith single content (backwards compatible)tools, returnsCreateMessageResultWithToolswhich allows array contentMotivation and Context
SEP-1577 changes
CreateMessageResult.contentfrom single tosingle | array. This would be a breaking change for existing SDK users. To avoid requiring a major version bump (v2.0), this PR diverges from the schema for v1.x backwards compatibility.The schema divergence is documented with a
FixSpecCreateMessageResultwrapper inspec.types.test.ts, following the existing pattern for other intentional divergences.How Has This Been Tested?
CreateMessageResultto use appropriate schemasBreaking Changes
None for v1.x users. Existing code that doesn't use tools continues to work unchanged.
Note: v2.0 will align
CreateMessageResultwith the schema (array content).Types of changes
Checklist