task. The
server then needs tasks.key, a MAC key that binds each task ID to the
caller who started it.
task takes these options, all optional:
tasks.lifetime bounds how long a task ID stays valid and sets ttlMs.
Without it, ttlMs is null. tasks.poll suggests the polling interval,
five seconds by default. Both are Temporal durations.
Task states
When the client declares theio.modelcontextprotocol/tasks extension, the
call returns a task handle once the submit commits. tasks/get reads
ctx.get(task) in the caller’s frame:
tasks/cancel runs cancel. Cancellation is cooperative: a task that has
already settled keeps its result. A client can also list taskIds on
subscriptions/listen to receive notifications/tasks
(Request lifecycle).
Ask the client for input
A task that waits on a person names that wait as a target performed by roles,target({ via: [roles], within }). List the pending tasks in
inputs, each with a form message and a flat requestedSchema:
input_required and its inputRequests
are keyed by the input’s slot. tasks/update answers it as
ctx.answer(task, { ok: true, value }), with the form content or what the
input’s answer(response) maps it to. The answer is an ordinary act: the
caller must hold one of the target’s roles, and guards on
act.answer(approve) judge it. Keys that are unknown or already answered
are ignored. A pending task the tool does not list keeps the MCP task
working.
Clients without the extension
A client that does not declare the extension receives the function’s own value. If it accepts a streamed response and sendsparams._meta.progressToken, the response stays open and reports
notifications/progress from status before that value. A tool that runs
as one transaction reports no progress.
Follow a task from a view
A view’s protocol subset guaranteestools/call but not tasks/*. When a
server has a task tool and a tool that views can reach, it adds two tools
that only views see: task_status({ taskId }), which answers what
tasks/get answers as structuredContent, and task_cancel({ taskId }).
Both use the same caller-bound task ID. A task tool that views can reach
carries that ID in _meta["com.bijection/taskId"]. The names task_status
and task_cancel are reserved on such a server.