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.
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 |