Skip to main content
Glama

opencode_session

Create and manage OpenCode coding-agent sessions to delegate coding tasks: start a session, send prompts or shell commands, switch models, and revert changes.

Instructions

Manage OpenCode coding agent sessions. START HERE: use action 'create' to get a session ID, then 'prompt' to send coding tasks. The agent has full file access (read/write/edit/bash). Use 'model' and 'provider' params on prompt/shell/command to switch models on the fly. Actions: create, get, list, status (overall status), children, update, delete, init, abort, share, unshare, summarize, revert (undo changes, pass messageId), unrevert, prompt (send task), promptAsync (send task, return immediately), command (run agent command), shell (run shell command), diff (get code diff, optional messageId), fork (fork session at a message), todo (get session todo list), permission (respond to tool permission requests — once/always/reject). Always reuse session IDs for related work.

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": {
      "action": "<action>"
    },
    "name": "opencode_session"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNoSession ID (required for most actions except create/list/status)
bodyNoAdditional body parameters (noReply, system, tools, etc.)
agentNoAgent to use for prompt/shell (e.g. 'coder', 'build'). Defaults to the configured agent.
modelNoModel ID to use (e.g. 'gpt-oss-120b', 'zai-glm-4.7', 'llama3.1-8b'). Overrides the default model for this prompt.
actionYes
contentNoPrompt content, command, or shell command
providerNoProvider ID (e.g. 'cerebras', 'opencode'). Required when specifying model.
responseNoPermission response (for permission action)
messageIdNoMessage ID (for diff, fork, revert)
permissionIdNoPermission ID (for permission action)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description carries the full disclosure burden, and it does surface important behavior: the agent has full file read/write/edit/bash access, promptAsync returns immediately, and revert undoes changes. However, for a 22-action tool it leaves key traits unstated — whether delete is permanent, whether share/unshare exposes the session beyond the caller, and what abort or init actually change. These omissions matter most for the destructive and sharing actions.

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?

The description is front-loaded with the START HERE workflow and the file-access caveat before the long action list, so the most decision-relevant content comes first. The action catalog is dense but nearly every entry earns its slot; 'prompt (send task)' slightly repeats the earlier sentence about sending coding tasks.

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 22-action, 10-parameter tool with no annotations and no output schema, the description covers initiation, model switching, safety exposure, and per-action meaning well enough to call it correctly. Remaining gaps are around return shapes for diff/todo/status/list and the side effects of delete and share, which are outside the schema's reach.

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

Parameters4/5

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

Schema coverage is already 90%, yet the description adds cross-parameter wiring the schema only implies: model/provider apply on prompt/shell/command, messageId is needed for revert, and id is required for most actions except create/list/status. The response enum values (once/always/reject) are restated from the schema, which is minor redundancy but helps scanning.

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

Purpose4/5

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

The description opens with a concrete verb and resource ('Manage OpenCode coding agent sessions') and then enumerates all 22 actions with short glosses, so an agent knows this is the session lifecycle tool rather than a message/file/project tool. It never explicitly contrasts itself with siblings like opencode_message or opencode_pty, so differentiation is inferred from the action list rather than stated.

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?

Strong operational guidance: 'START HERE: use action create to get a session ID, then prompt' gives an explicit entry sequence, and 'Always reuse session IDs for related work' sets a default policy. It also distinguishes close alternatives within the action set (prompt vs promptAsync, revert vs unrevert, status vs get). It stops short of saying when to avoid this tool or hand off to a sibling.

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