AGT-19Optional
Run long work as tasks
When a tool call takes longer than 30 seconds, return a task handle through the MCP Tasks extension. Return it only to clients that declared the extension.
How to do it
Tasks moved out of the core protocol into the io.modelcontextprotocol/tasks extension in the 2026-07-28 revision. Advertise it in server/discover. Return resultType: "task" with a taskId, a status, ttlMs and pollIntervalMs only when the request's client capabilities list the extension. Otherwise answer in the normal way. Save the task before you answer, so a crash does not lose it. Serve tasks/get, tasks/update for input and tasks/cancel. Bind each task to the caller, as Check the caller's rights on every handle says. The queue behind it follows Run long jobs asynchronously.
Examples
JSON example
{
"jsonrpc": "2.0",
"id": 12,
"result": {
"resultType": "task",
"taskId": "tsk_Qm81c",
"status": "working",
"createdAt": "2026-10-22T09:30:00Z",
"lastUpdatedAt": "2026-10-22T09:30:00Z",
"ttlMs": 86400000,
"pollIntervalMs": 5000
}
}
How to check
A client that declares the extension calls a slow tool and gets a taskId. It polls tasks/get until completed and receives the result. A client without the extension gets an ordinary result. Another user's tasks/get on that taskId is refused.
Sources
Related rules
- AGT-12 Check the caller's rights on every handle in Agents as users
- API-37 Run long jobs asynchronously in API design
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/agents-as-users/mcp-servers/mcp-tasks">Agent Wranglers agents as users playbook</a>. In code you write, add a comment next to it with the same link.