Task management for long-running MCP operations (experimental).
Tasks provide a durable state machine for operations that may take time to complete. Clients can poll for status, cancel in-flight operations, and receive results asynchronously.
Task Lifecycle
working → completed
working → failed
working → cancelled
working → input_required → working (after elicitation)Usage
Tasks are stored in a pluggable store (defaults to ETS via ConduitMcp.Session.EtsStore
pattern). The task registry is managed per-server.
Configuration
Enable tasks in your transport config:
{ConduitMcp.Transport.StreamableHTTP,
server_module: MyServer,
tasks: [enabled: true]}
Summary
Functions
Cancels a task.
Removes terminal-state tasks (completed, failed, cancelled) older than
ttl_ms milliseconds. Tasks still in working or input_required are never
evicted regardless of age.
Creates a new task in the ETS store.
Deletes a task by ID.
Generates a unique task ID.
Gets a task by ID.
Lists all tasks, optionally filtered by status.
Updates a task's status and/or metadata.
Returns the list of valid task statuses.
Validates that a status transition is allowed.
Types
@type status() :: :working | :input_required | :completed | :failed | :cancelled
@type task_id() :: String.t()
Functions
Cancels a task.
Removes terminal-state tasks (completed, failed, cancelled) older than
ttl_ms milliseconds. Tasks still in working or input_required are never
evicted regardless of age.
Returns the count of tasks removed.
Creates a new task in the ETS store.
Deletes a task by ID.
Returns :ok whether or not the task existed.
Generates a unique task ID.
Gets a task by ID.
Lists all tasks, optionally filtered by status.
Updates a task's status and/or metadata.
Returns the list of valid task statuses.
Validates that a status transition is allowed.