---
title: "Run long work as tasks · Agent Wranglers"
url: https://agentwranglers.se/playbook/agents-as-users/mcp-servers/mcp-tasks
id: AGT-19
level: Optional
updated: 2026-10-22
tokens: 796
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Run long work as tasks

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [MCP servers](https://agentwranglers.se/playbook/agents-as-users/mcp-servers.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: AGT-19
- Level: Optional
- Chapter: [MCP servers](https://agentwranglers.se/playbook/agents-as-users/mcp-servers.md)
- Rule: 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.
- 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.
- How: 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](https://agentwranglers.se/playbook/agents-as-users/mcp-servers/check-handle-owner.md) says. The queue behind it follows [Run long jobs asynchronously](https://agentwranglers.se/playbook/api-design/reliability/long-running-jobs.md).

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JSON example

```json
{
  "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
  }
}
```

## Sources

- [MCP Tasks extension](https://modelcontextprotocol.io/extensions/tasks/overview)

## Related rules

- AGT-12 [Check the caller's rights on every handle](https://agentwranglers.se/playbook/agents-as-users/mcp-servers/check-handle-owner.md) in Agents as users
- API-37 [Run long jobs asynchronously](https://agentwranglers.se/playbook/api-design/reliability/long-running-jobs.md) in API design

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/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.

- Previous: [Sign the state you hand back for a second round](https://agentwranglers.se/playbook/agents-as-users/mcp-servers/signed-request-state.md)
- [MCP servers](https://agentwranglers.se/playbook/agents-as-users/mcp-servers.md)
