FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: expose MRTR state to tool handlers by DaleSeo · Pull Request #1104 · modelcontextprotocol/rust-sdk · GitHub

fix: expose MRTR state to tool handlers - #1104

Merged
DaleSeo merged 2 commits into
mainfrom
fix/mrtr-tool-context
Aug 5, 2026
Merged

fix: expose MRTR state to tool handlers#1104
DaleSeo merged 2 commits into
mainfrom
fix/mrtr-tool-context

Conversation

DaleSeo commented Jul 31, 2026
edited
Loading

Copy link
Copy Markdown
Member

Fixes #1095.

Motivation and Context

ToolCallContext::new was dropping request_state and input_responses, so #[tool] handlers could not continue an MRTR call after the client completed its input requests. Because of that, servers had to bypass the macro routing path and implement ServerHandler::call_tool manually.

This PR preserves the SEP-2322 retry state and input responses when macro-generated tool handlers route calls through ToolCallContext. It also adds extractors for both values and lets #[tool] handlers return CallToolResponse. This allows a single handler to produce both input_required responses and completed results.

How Has This Been Tested?

Added regression tests

Breaking Changes

None.

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

github-actions Bot added T-test Testing related changes T-core Core library changes T-handler Handler implementation changes labels Jul 31, 2026
DaleSeo marked this pull request as ready for review July 31, 2026 00:22
DaleSeo requested a review from a team as a code owner July 31, 2026 00:22
DaleSeo self-assigned this Jul 31, 2026
DaleSeo force-pushed the fix/mrtr-tool-context branch from b0c2ce4 to aff4f5c Compare July 31, 2026 15:11
alexhancock previously approved these changes Aug 3, 2026
pub service: &'s S,
pub name: Cow<'static, str>,
pub arguments: Option<JsonObject>,
/// Client responses to input requests from the previous MRTR round.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd strip these comments

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@alexhancock Would you be open to documenting the existing fields instead? Since this struct is public, I think rustdoc for all of its fields would be useful and more consistent.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I've added comments to the existing fields.

DaleSeo merged commit c4def55 into main Aug 5, 2026
22 checks passed
DaleSeo deleted the fix/mrtr-tool-context branch August 5, 2026 13:55
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

Labels

T-core Core library changes T-handler Handler implementation changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[tool] drops request_state/input_responses, so MRTR handlers cannot use it

2 participants


Back | FazBrowse Home | New Git URL