Available on crate feature
server only.Expand description
Server-side runtime for the MCP Tasks extension (SEP-2663,
io.modelcontextprotocol/tasks).
TaskManager owns the durable state for tasks a server has materialized
in response to task-eligible requests (currently tools/call). It:
- spawns the underlying operation and tracks its lifecycle as a
DetailedTask(working→ terminal, optionally viainput_required), - answers
tasks/getwith the current state (including in-flightinputRequestsand terminalresult/errorpayloads), - accepts
tasks/updateinputResponsesand routes them to the running operation (ignoring unknown or already-answered keys per spec), - handles cooperative
tasks/cancel, - enforces TTL-based expiry (
ttl_ms), marking overdue tasksfailed.
Tasks are only durably observable once TaskManager::spawn returns,
satisfying the spec requirement that a server not return CreateTaskResult
before tasks/get for that id would resolve.
Structs§
- Task
Context - Handle passed to a running task operation, allowing it to surface
server-to-client requests (elicitation, sampling, roots) mid-task and
await the client’s
tasks/updateresponse. - Task
Manager - Server-side task store and executor for the SEP-2663 Tasks extension.
- Task
Options - Options controlling a spawned task.
Enums§
- Task
Exit - How a task operation finished without producing a result.
Constants§
- DEFAULT_
POLL_ INTERVAL_ MS - Default suggested polling interval, in milliseconds.
- DEFAULT_
TASK_ TTL_ MS - Default TTL (5 minutes, in milliseconds) applied when none is specified.
Functions§
- current_
timestamp - Helper to generate an ISO 8601 timestamp for task metadata.
Type Aliases§
- Task
Future - Boxed future representing the async operation backing a task.