Uh oh!
There was an error while loading. Please reload this page.
feat!: add MRTR model types (SEP-2322) - #915
Merged
Merged
Conversation
DaleSeoforce-pushed
the
sep-2322-mrtr-types
branch
2 times, most recently
from
June 20, 2026 22:23
76dee33 to
43a0078Compare6 tasks
DaleSeoforce-pushed
the
sep-2322-mrtr-types
branch
2 times, most recently
from
June 20, 2026 23:49
5f7c682 to
bccd656CompareDaleSeoforce-pushed
the
sep-2322-mrtr-types
branch
4 times, most recently
from
June 22, 2026 13:40
bb59388 to
ed7dfe0CompareDaleSeoforce-pushed
the
sep-2322-mrtr-types
branch
from
June 23, 2026 22:29
ed7dfe0 to
320873bCompareDaleSeoforce-pushed
the
sep-2322-mrtr-types
branch
from
June 25, 2026 14:45
320873b to
2b7c5cfCompareDaleSeo
marked this pull request as ready for review
June 26, 2026 15:25
DaleSeoforce-pushed
the
sep-2322-mrtr-types
branch
from
June 26, 2026 20:52
2b7c5cf to
ceb6d1fCompare
Comment on lines
+1264
to
+1266
| /// Result type discriminator. Always serialized; older peers ignore it. | ||
| #[serde(default)] | ||
| pub result_type: ResultType, |
Contributor
There was a problem hiding this comment.
I found this to be not actually happening with all peers. Notably, the MCP inspector explicitly rejected
Contributor
There was a problem hiding this comment.
I think it might have only been on the EmptyResult type though so perhaps here specifically is ok. This PR doesn't actually change EmptyResult to have ResultType.
In my work on this I ended up using Option<ResultType> to make it so we could avoid serializing this for older peers
MemberAuthor
There was a problem hiding this comment.
Good point, @howardjohn. I removed the wording that implied all older peers tolerate the extra field. This PR is focused on model changes, so I'll tackle your concern in a follow-up PR.
9 tasks
alexhancock
approved these changes
Jul 7, 2026
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 freeto 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. AddingInputRequiredResultto the exhaustiveServerResultunion is an API-breaking change.Types of changes
Checklist