Skip to content

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

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

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

Conversation

@KirschBluteX

@KirschBluteX KirschBluteX commented Aug 13, 2026

Copy link
Copy Markdown

Summary

  • route InputRequiredException from task-backed [McpServerTool] executions through the existing task input-request interceptor
  • replay the tool after tasks/update, carrying InputResponses and RequestState into both the typed and JSON-RPC request parameters
  • cover elicitation, sampling, and roots requests, including cancellation, input-handler failures, waiter cleanup, and the legacy synchronous MRTR fallback
  • document explicit MRTR composition with Tasks

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 (71 passed)
  • dotnet format tests/ModelContextProtocol.Tests/ModelContextProtocol.Tests.csproj --verify-no-changes --no-restore --include tests/ModelContextProtocol.Tests/Server/McpTaskStoreTests.cs src/ModelContextProtocol.Extensions.Tasks/Server/McpTasksBuilderExtensions.cs --verbosity minimal
  • dotnet test tests/ModelContextProtocol.Tests/ModelContextProtocol.Tests.csproj --configuration Release --framework net10.0 --no-build --no-restore --filter "Execution!=Manual" --verbosity minimal (2361 passed)
  • DockerEverythingServerTests.ConnectAndReceiveMessage_EverythingServerWithSse (1 passed)
  • DockerEverythingServerTests.Sampling_Sse_EverythingServer (manual external-dependency test) still fails in isolation because tzolov/mcp-everything-server:v1 resolves to the 2024-12-15 image, which exposes sampleLLM rather than the test's expected trigger-sampling-request; pulling the tag again returns the same digest.

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