Skip to main content
Glama

OpenCode Cancel

opencode-cancel
DestructiveIdempotent

Stop the current turn on an OpenCode session without ending it, so a new reply can be sent. Requires exactly one of sessionId, threadId, or conversationId.

Instructions

Use this to stop the turn currently running on an OpenCode session without ending the session, so a new opencode-reply can be sent afterwards. Requires exactly one of sessionId, threadId or conversationId. Idempotent when the session is already idle; the result is in structuredContent.content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
threadIdNoAlias 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.
sessionIdNoId 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.
conversationIdNoDeprecated 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

TableJSON Schema
NameRequiredDescriptionDefault
costNo
diffNo
hintNo
kindYes
turnNo
agentNo
errorNo
modelNo
rootsNo
totalNo
actionNo
agentsNo
finishNo
modelsNo
offsetNo
outputNo
reasonNo
serverNo
statusYes
tokensNo
turnIdNo
cleanupNo
contentYes
hasMoreNo
partialNo
requestNo
resultsNo
sectionNo
waitForNo
readyIdsNo
sessionsNo
threadIdNo
warningsNo
directoryNo
elapsedMsNo
sessionIdNo
toolCallsNo
truncatedNo
nextOffsetNo
observedAtNo
pendingIdsNo
snapshotIdNo
availabilityNo
filesChangedNo
resendSafetyNo
responseLoopNo
upstreamReadNo
omittedFieldsNo
toolCallCountNo
upstreamRetryNo
executionStateNo
opencodeVersionNo
pendingApprovalsNo
structuredOutputNo
filesChangedCountNo
abortedRunningTurnNo
pendingApprovalCountNo
structuredOutputErrorNo
structuredOutputStatusNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare idempotentHint=true and destructiveHint=true; the description refines this by specifying idempotency holds 'when the session is already idle' and that the result lands in structuredContent.content. It does not disclose what the cancellation destroys (in-flight tool calls or partial output), which is the one gap left against a destructiveHint=true annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, purpose front-loaded, no filler. The middle sentence restates the schema's exactly-one-of constraint, which is the only redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple single-action tool with a full output schema, the description covers purpose, targeting, idempotency and where the result lives. The only omission is what a cancellation discards, which an agent might reasonably want to know before invoking a destructive-hinted tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and each alias is fully documented in the schema, including the exactly-one-of rule that the description repeats. The description adds no new meaning about the parameters, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a precise verb+resource+scope: stop the currently running turn on an OpenCode session, explicitly without ending the session. It differentiates from siblings by naming opencode-reply as the follow-up and implying opencode-end is the alternative when the session should die.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear triggering condition — the turn is running and you want to send a new reply — and an implied exclusion via 'without ending the session'. It never names opencode-end as the tool to use when termination is actually wanted, so the routing guidance is good but not exhaustive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.