feat!: add SEP-2322 MRTR model types#915
Draft
DaleSeo wants to merge 1 commit into
Draft
Conversation
76dee33 to
43a0078
Compare
6 tasks
5f7c682 to
bccd656
Compare
bb59388 to
ed7dfe0
Compare
ed7dfe0 to
320873b
Compare
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.
Motivation and Context
SEP-2322 introduces a stateless pattern where a server responds to
tools/call,prompts/get, orresources/readwith anInputRequiredResult(carryinginputRequestsand/orrequestState), and the client retries withinputResponses. This replaces the previousURLElicitationRequiredError(-32042) approach. Relates to #871.The draft spec also adds a
resultTypediscriminator to the baseResulttype (requiredin the JSON schema). This PR addsresult_type: ResultTypeto all server result types that require it per the schema:CallToolResult,GetPromptResult,ReadResourceResult,CompleteResult, and the four paginated results (ListToolsResult,ListPromptsResult,ListResourcesResult,ListResourceTemplatesResult).resultTypeis always serialized (matching the Python SDK's approach per the spec's MUST). Types that don't haveresultTypein the schema (InitializeResult, task results, client results) are unchanged.This PR adds only the model/serde layer. Behavior wiring (server emit, client retry, version gating) is planned for a follow-up.
How Has This Been Tested?
13 unit tests in
model/mrtr.rscovering serde round-trips against spec example JSON, rejection of missing/wrongresultType, unknown extension value preservation, and constructor behavior. Full suite passes with 0 failures.Breaking Changes
All server result types gain a
result_type: ResultTypefield. The field defaults to"complete"and is always serialized, so responses now include"resultType": "complete". Struct literals that construct result types directly (not through constructors or..Default::default()) will need the new field added. The#[tool_handler]and#[prompt_handler]proc macros have been updated. The SemVer check flags addingInputRequiredResultto the exhaustiveServerResultunion.Types of changes
Checklist