Run OpenCode as an MCP Task
opencode.run_taskStart a durable implementation task that recovers after MCP restart, using OpenCode to execute instructions in the current project.
Instructions
Starts a durable OpenCode task when the MCP host negotiates task support. The task is recovered from the OpenCode session after MCP restart.
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": "<task>"
},
"name": "opencode.run_task"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | Yes | A concise implementation instruction. OpenCode reads the current project itself. | |
| model | No | An existing OpenCode provider/model ID. | |
| reuse | No | Reuse a recent compatible primary session; defaults to true. | |
| sessionId | No | An existing OpenCode session ID to resume. | |
| backgroundSubagents | No | Allow only OpenCode native background subagents for independent work. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| async | Yes | ||
| output | No | ||
| reused | Yes | ||
| status | Yes | ||
| modelId | No | ||
| sessionId | Yes |