Cancel a running opencode task
opencode_cancelStop a running opencode task by sending SIGTERM to its process group, escalating to SIGKILL after a grace period. Poll opencode_status to confirm cancellation.
Instructions
Stop a running task: sends SIGTERM to the task's whole process group (opencode and any subprocess it spawned), escalating to SIGKILL after a grace period if it hasn't exited. A finished task's status is unaffected and returns a note instead of an error. Poll opencode_status afterward; the task moves to status 'cancelled' once its exit event lands.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"task_id": "<task_id>"
},
"name": "opencode_cancel"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | Task id returned by opencode_dispatch. | |
| grace_ms | No | Milliseconds to wait after SIGTERM before escalating to SIGKILL. Defaults to 5000. |