Skip to content

feat!: add SEP-2322 MRTR model types#915

Draft
DaleSeo wants to merge 1 commit into
mainfrom
sep-2322-mrtr-types
Draft

feat!: add SEP-2322 MRTR model types#915
DaleSeo wants to merge 1 commit into
mainfrom
sep-2322-mrtr-types

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Jun 20, 2026

Copy link
Copy Markdown
Member

Motivation and Context

SEP-2322 introduces a stateless pattern where a server responds to tools/call, prompts/get, or resources/read with an InputRequiredResult (carrying inputRequests and/or requestState), and the client retries with inputResponses. This replaces the previous URLElicitationRequiredError (-32042) approach. Relates to #871.

The draft spec also adds a resultType discriminator to the base Result type (required in the JSON schema). This PR adds result_type: ResultType to all server result types that require it per the schema: CallToolResult, GetPromptResult, ReadResourceResult, CompleteResult, and the four paginated results (ListToolsResult, ListPromptsResult, ListResourcesResult, ListResourceTemplatesResult). resultType is always serialized (matching the Python SDK's approach per the spec's MUST). Types that don't have resultType in 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.rs covering serde round-trips against spec example JSON, rejection of missing/wrong resultType, unknown extension value preservation, and constructor behavior. Full suite passes with 0 failures.

cargo test -p rmcp --lib mrtr::tests
cargo test -p rmcp

Breaking Changes

All server result types gain a result_type: ResultType field. 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 adding InputRequiredResult to the exhaustive ServerResult union.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@DaleSeo DaleSeo self-assigned this Jun 20, 2026
@github-actions github-actions Bot added T-test Testing related changes T-config Configuration file changes T-core Core library changes T-handler Handler implementation changes T-model Model/data structure changes T-service Service layer changes labels Jun 20, 2026
@DaleSeo DaleSeo force-pushed the sep-2322-mrtr-types branch 2 times, most recently from 76dee33 to 43a0078 Compare June 20, 2026 22:23
@DaleSeo DaleSeo linked an issue Jun 20, 2026 that may be closed by this pull request
6 tasks
@DaleSeo DaleSeo force-pushed the sep-2322-mrtr-types branch 2 times, most recently from 5f7c682 to bccd656 Compare June 20, 2026 23:49
@github-actions github-actions Bot added the T-macros Macro changes label Jun 20, 2026
@DaleSeo DaleSeo force-pushed the sep-2322-mrtr-types branch 4 times, most recently from bb59388 to ed7dfe0 Compare June 22, 2026 13:40
@github-actions github-actions Bot added the T-examples Example code changes label Jun 22, 2026
@DaleSeo DaleSeo force-pushed the sep-2322-mrtr-types branch from ed7dfe0 to 320873b Compare June 23, 2026 22:29
@DaleSeo DaleSeo changed the title feat: add SEP-2322 MRTR model types feat!: add SEP-2322 MRTR model types Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2026-07-28 T-config Configuration file changes T-core Core library changes T-examples Example code changes T-handler Handler implementation changes T-macros Macro changes T-model Model/data structure changes T-service Service layer changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SEP-2322: Multi Round-Trip Requests

1 participant