Skip to content

Compose MRTR input requests with task-backed tools - #1814

Open
KirschBluteX wants to merge 2 commits into
modelcontextprotocol:mainfrom
KirschBluteX:fix/task-aware-mrtr-1635
Open

Compose MRTR input requests with task-backed tools#1814
KirschBluteX wants to merge 2 commits into
modelcontextprotocol:mainfrom
KirschBluteX:fix/task-aware-mrtr-1635

Conversation

@KirschBluteX

@KirschBluteX KirschBluteX commented Aug 13, 2026

Copy link
Copy Markdown

Summary

  • share one internal input-required runner between Core MRTR backcompat and task-backed tool execution, so thrown and returned InputRequiredResult values follow the same retry limit, state replacement, and malformed-result rules
  • route task-backed elicitation, sampling, and roots requests through the existing task outgoing-request interceptor and resume the tool after tasks/update
  • cancel sibling input waiters when a request fails, observe late failures, and clean up subscribers on cancellation
  • preserve native MRTR responses and legacy synchronous MRTR backcompat while covering state-only and multi-round retries
  • document the implemented task/MRTR composition behavior

This implements Case 1 only. Case 2, mid-execution promotion through a DeferTaskCreation/PromoteToTaskAsync-style API, remains separate pending its public API and lifecycle design.

Partially addresses #1635

Testing

  • dotnet build ModelContextProtocol.slnx --configuration Release --no-restore -m:1 --verbosity minimal (36 projects, 0 warnings, 0 errors)
  • dotnet test tests/ModelContextProtocol.Tests/ModelContextProtocol.Tests.csproj --configuration Release --framework net10.0 --no-build --no-restore --filter "FullyQualifiedName~McpTaskStoreTests|FullyQualifiedName~MrtrServerBackcompatTests|FullyQualifiedName~MrtrInputRequiredExceptionTests|FullyQualifiedName~MrtrReturnedInputRequiredResultNativeTests|FullyQualifiedName~MrtrHandlerLifecycleTests" --verbosity minimal (77 passed)
  • dotnet test tests/ModelContextProtocol.AspNetCore.Tests/ModelContextProtocol.AspNetCore.Tests.csproj --configuration Release --framework net10.0 --no-build --no-restore --filter "FullyQualifiedName~Mrtr_Backcompat_" --verbosity minimal (12 passed, 6 stateless variants skipped by design)
  • dotnet format tests/ModelContextProtocol.Tests/ModelContextProtocol.Tests.csproj --verify-no-changes --no-restore --include <changed Core/Tasks test and source files> --verbosity minimal
  • git diff --check

A broader Execution!=Manual test run was stopped after more than five minutes without a final result; no pass is claimed for that run.

The upstream workflows for this fork PR are currently action_required and need maintainer approval to run; this is not a CI failure.

@KirschBluteX
KirschBluteX force-pushed the fix/task-aware-mrtr-1635 branch from 10dc481 to 5e30a19 Compare August 15, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant