CorefinityCorefinityDocs
Open the Control PanelControl Panel
Essentials · 8 of 16

Long-running tasks

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

On this page

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.

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

RuleValue
Statusesworking, then completed, cancelled or failed
Poll interval5 seconds
Result kept after the task ends24 hours
Who can read or cancel a taskThe grant that started it, while it still holds the scopes and pins that call needed
Canceltasks/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.

ArgumentDefaultMaximum
wait_seconds: how long the call waits3060
timeout_seconds: how long the command may run3,60086,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.

Was this helpful?
Open in ClaudeOpen in ChatGPT