Skip to content

Implement MCP Tasks runtime for .LongRunning() commands (ModelContextProtocol.Extensions.Tasks) #72

Description

@carldebilly

Context

SDK 2.0 extracted MCP Tasks into ModelContextProtocol.Extensions.Tasks (2.0.0-preview.3): IMcpTaskStore/InMemoryMcpTaskStore, task results/notifications (CreateTaskResult, GetTaskResult, CancelTaskResult, completed/failed/cancelled/input-required), and client helpers (CallToolAsTaskAsync, CallToolWithPollingAsync). The per-tool Tool.Execution augmentation is gone from the protocol surface.

Since PR #71, Repl keeps .LongRunning() in its own model (help/docs) and deliberately does not advertise task support at the protocol level — per #51's non-goal: no advertisement until polling/cancel/update works end-to-end.

Scope

  • Reference ModelContextProtocol.Extensions.Tasks and wire a task store (in-memory by default, pluggable).
  • Route .LongRunning() tool calls through the task lifecycle: create → progress → completed/failed/cancelled, honoring cancellation.
  • Handle tasks/get, tasks/update, tasks/cancel and the corresponding notifications.
  • Advertise task capability once the runtime is complete (whatever shape the SDK exposes at that point — the per-tool augmentation no longer exists).
  • End-to-end tests using the SDK client's CallToolAsTaskAsync/CallToolWithPollingAsync.
  • Update docs/mcp-reference.md#sdk-and-protocol-versions and the .LongRunning() doc mentions when advertisement returns.

Notes

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions