part…
Building governance for MCP?
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
Not every tool responds instantly: pipelines, batch processes, human approvals. Tasks lets the server return a durable handle instead of blocking; the client polls, provides input if needed and collects the result even if it has disconnected. As of 2026-07-28 it is an extension (previously, an experimental core utility).
Long connections collide with client and intermediary timeouts; a taskId survives crashes and restarts; the state gives visibility; mid-flight input does not need unsolicited messages; and it is server-driven: the client opts in once by capability and accepts any result shape, with no per-request flags.
io.modelcontextprotocol/tasks in its per-request capabilities; the server advertises it in server/discover.CreateTaskResult (resultType: "task") with taskId, initial state, ttlMs and pollIntervalMs. The task must be durably created before responding.tasks/get with taskId → current state; in terminal states, result or error.input_required, tasks/get includes inputRequests; the client responds with tasks/update (inputResponses).completed → result with what the original request would have returned; failed → JSON-RPC error.tasks/cancel at any time; cooperative (the server acknowledges the intent, it is not obliged to stop).sequenceDiagram
participant C as Client
participant S as Server
C->>S: tools/call (tasks capability)
S-->>C: CreateTaskResult (taskId, working)
loop polling
C->>S: tasks/get
S-->>C: Task (working)
end
C->>S: tasks/get
S-->>C: Task (input_required, inputRequests)
C->>S: tasks/update (inputResponses)
S-->>C: ack
C->>S: tasks/get
S-->>C: Task (completed, result)
| State | Meaning |
|---|---|
working |
In progress. |
input_required |
Needs input from the client (inputRequests). |
completed |
Finished; result available. |
failed |
JSON-RPC error; error available. |
cancelled |
Cancelled (not always honoured). |
completed, failed and cancelled are terminal.
The server can push notifications/tasks with the full state; the client opts in via subscriptions/listen. Polling is the default mode.
Client: declare the extension; handle polymorphic results; poll honouring pollIntervalMs until a terminal state; handle input_required via tasks/update; persist the ids to resume after a restart.
Server: advertise the extension; never return a task to a client that did not declare it; create durably before responding; serve tasks/get with result/error in terminal states; accept tasks/update (ignore unknown or already satisfied keys) and respond with an empty result; accept tasks/cancel with an empty result and honour it if it can.
| 2025-11-25 (core, experimental) | 2026-07-28 (extension) |
|---|---|
Per-request opt-in with params.task and tasks.requests.* capabilities; execution.taskSupport per tool. |
Opt-in by extension capability; the server decides per request. |
Blocking tasks/result to obtain the result. |
tasks/get returns result inline in terminal states. |
Paginated tasks/list. |
Removed: the client persists its handles. |
input_required resolved with server requests over the stream (related-task). |
inputRequests in tasks/get + tasks/update. |
notifications/tasks/status on any stream. |
notifications/tasks via subscriptions/listen. |
ttl, pollInterval fields. |
ttlMs, pollIntervalMs. |
With an authorization context, the server MUST bind tasks to it and reject tasks/get/update/cancel from other contexts; without a context, cryptographically secure ids and short TTLs; limits on concurrent tasks and on TTL; cleanup; rate limiting against enumeration; logging of creation, completion and retrieval with the authorization context.
inputRequests) or materialising (you poll and deliver complete to the host). The latter makes you stateful and responsible for durability.tasks/list); consider supporting only one tasks era per server.taskId, user and server.1. How does a modern client opt in to receiving tasks?
The opt-in is by capability; the server decides per request whether to create a task.
2. How is the final result of a task obtained in the extension?
tasks/result was removed.
3. Which method does the client use to respond to a task's inputRequests?
tasks/update carries inputResponses.
4. Is task cancellation guaranteed?
The server acknowledges the intent but may end in another terminal state.