OpenCode End
opencode-endEnd an OpenCode session by ID: stop the running turn, reject pending permission prompts, then delete or archive the session and remove it from tracking.
Instructions
Use this to finish working with an OpenCode session: it stops any running turn, rejects any leftover permission prompts, then deletes or archives the session and forgets it (action, default 'delete' — this server's configured OPENCODE_MCP_END_ACTION). Requires exactly one of sessionId, threadId or conversationId. Idempotent: ending an unknown or already-ended session returns structuredContent.status "not_found" without contacting OpenCode.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | Whether to delete or archive the session when ending it. Default is this server's configured OPENCODE_MCP_END_ACTION (see this tool's description for the current default). | |
| threadId | No | Alias for sessionId (Codex-compatible name), same session id value. Exactly one of sessionId, threadId, conversationId is required to target a session; opencode-status may omit all three to list tracked sessions instead. | |
| sessionId | No | Id of a session tracked by this server, from a prior opencode call. Exactly one of sessionId, threadId, conversationId is required to target a session; opencode-status may omit all three to list tracked sessions instead. | |
| conversationId | No | Deprecated alias for sessionId, same session id value. Exactly one of sessionId, threadId, conversationId is required to target a session; opencode-status may omit all three to list tracked sessions instead. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cost | No | ||
| diff | No | ||
| hint | No | ||
| kind | Yes | ||
| turn | No | ||
| agent | No | ||
| error | No | ||
| model | No | ||
| roots | No | ||
| total | No | ||
| action | No | ||
| agents | No | ||
| finish | No | ||
| models | No | ||
| offset | No | ||
| output | No | ||
| reason | No | ||
| server | No | ||
| status | Yes | ||
| tokens | No | ||
| turnId | No | ||
| cleanup | No | ||
| content | Yes | ||
| hasMore | No | ||
| partial | No | ||
| request | No | ||
| results | No | ||
| section | No | ||
| waitFor | No | ||
| readyIds | No | ||
| sessions | No | ||
| threadId | No | ||
| warnings | No | ||
| directory | No | ||
| elapsedMs | No | ||
| sessionId | No | ||
| toolCalls | No | ||
| truncated | No | ||
| nextOffset | No | ||
| observedAt | No | ||
| pendingIds | No | ||
| snapshotId | No | ||
| availability | No | ||
| filesChanged | No | ||
| resendSafety | No | ||
| responseLoop | No | ||
| upstreamRead | No | ||
| omittedFields | No | ||
| toolCallCount | No | ||
| upstreamRetry | No | ||
| executionState | No | ||
| opencodeVersion | No | ||
| pendingApprovals | No | ||
| structuredOutput | No | ||
| filesChangedCount | No | ||
| abortedRunningTurn | No | ||
| pendingApprovalCount | No | ||
| structuredOutputError | No | ||
| structuredOutputStatus | No |