---
title: "Long-running tasks"
url: https://docs.corefinity.com/mcp/long-running-tasks
type: page
last_updated: 2026-11-13
feature: mcp
---
# Long-running tasks

How an assistant follows work that outlives one MCP call, such as a deployment, a restore or a shell command.

Work that takes longer than one request, such as creating a site, restoring a backup or running a command, answers with a task. The assistant polls the task until it ends, then reads the result.

The API follows the same work as operations: see [Long-running work](/api/long-running-work).

## Follow a task

1. **Start the work**

   Call the tool. It answers a task id and a status of `working`.

   ```json
   {
     "taskId": "cfmcpt_a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6",
     "status": "working",
     "statusMessage": "Snapshot queued",
     "pollIntervalMs": 5000
   }
   ```

2. **Poll the task**

   Read the task every 5 seconds with `tasks/get`. A client without tasks support calls `corestack_task_get` instead.

   ```json
   {
     "name": "corestack_task_get",
     "arguments": {
       "task_id": "cfmcpt_a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6"
     }
   }
   ```

3. **Read the result**

   When the status is `completed`, the answer carries the tool's final result. Work that ended badly is `completed` too: its result is a refusal such as `work_failed` or `command_failed`, so check `isError`.

## Rules

| Rule                            | Value                                                                                |
| ------------------------------- | ------------------------------------------------------------------------------------ |
| Statuses                        | `working`, then `completed`, `cancelled` or `failed`                                 |
| Poll interval                   | 5 seconds                                                                            |
| Result kept after the task ends | 24 hours                                                                             |
| Who can read or cancel a task   | The grant that started it, while it still holds the scopes and pins that call needed |
| Cancel                          | `tasks/cancel` or `corestack_task_cancel`                                            |

A cancel stops work the Control Panel can stop. A change that cannot be stopped keeps running, and its status says so.

## Commands

`corestack_exec_command` waits before it answers a task, so a short command returns its output in one call.

| Argument                                        | Default | Maximum |
| ----------------------------------------------- | ------- | ------- |
| `wait_seconds`: how long the call waits         | 30      | 60      |
| `timeout_seconds`: how long the command may run | 3,600   | 86,400  |

Read a running command's output with `corestack_command_output_get` and stop it with `corestack_command_cancel`.

A grant that is revoked or expires stops its commands: see [Revoke access](/mcp/revoke-access).
