Skip to main content
Glama

opencode-hermes-mcp

License: MIT Python OpenCode

Deterministic MCP controller between Hermes (supervisor LLM) and the permanent OpenCode server. The controller is a state machine — no LLM — that blocks on OpenCode turns and surfaces questions/permissions to Hermes so the supervisor LLM can decide and resume the same turn.

Architecture

Hermes (LLM)  --MCP stdio-->  opencode_hermes_mcp.server (FastMCP, 6 tools)  --HTTP + SSE-->  OpenCode server :4096
  • Layer 1 — Hermes: the supervisor LLM. It delegates a coding task with opencode_run and decides when the controller reports needs_agent_input (question / permission).

  • Layer 2 — this controller (opencode_hermes_mcp/: server.py + controller.py + client.py + models.py): a NO-LLM process spawned by Hermes over MCP stdio. It submits the task, watches SSE + REST, blocks until the turn completes / errors / needs input, and posts the supervisor's decisions back into the same OpenCode turn (the prompt is never resubmitted).

  • Layer 3 — OpenCode server: a permanent opencode serve process (systemd user service opencode-server, loopback :4096, HTTP basic auth). Its LLM is any supported provider (OpenAI-compatible endpoint, OpenAI, or Anthropic), configured in ~/.config/opencode/opencode.json.

Tools exposed to Hermes: opencode_run, opencode_answer, opencode_permission, opencode_abort, opencode_inspect (diagnostic only), opencode_sessions.

Related MCP server: opencode-executor-mcp

Prerequisites

  • Hermes installed (~/.hermes/config.yaml present)

  • python3 >= 3.11 (with PyYAML for the Hermes config patch)

  • Network access (OpenCode binary install, mcp package, LLM endpoint)

  • systemd user sessions (for the opencode-server service)

Installation (2 commands)

git clone <repo-url> opencode-hermes-mcp && cd opencode-hermes-mcp
scripts/install.sh

scripts/install.sh is a thin wrapper around the setup wizard (opencode_hermes_mcp/installer.py, Python + rich): banner, numbered steps, styled prompts, progress, and a summary panel. The wizard bootstraps itself — if the repo venv is missing (or lacks rich / pyyaml / mcp==1.12.4 / the editable package), it creates it and re-execs, so a bare python3 >= 3.11 is the only prerequisite.

The install is idempotent — re-running it skips what is already in place. It installs the pinned OpenCode binary, the venv (the opencode_hermes_mcp package with mcp==1.12.4 pinned), the LLM provider config + secret, the server credentials, the two launchers, the systemd user service, and patches ~/.hermes/config.yaml (backup kept as .bak). It finishes with a health check (bounded curl --max-time 3, last error surfaced) + python -m opencode_hermes_mcp.smoke_client (must print tool surface OK).

LLM providers

The installer is provider-agnostic. Three providers are supported:

Provider

Use

npm package

openai-compatible

any OpenAI-compatible endpoint (Unsloth, Ollama, vLLM, llama-server, ...) — default

@ai-sdk/openai-compatible

openai

official OpenAI API

@ai-sdk/openai

anthropic

official Anthropic API

@ai-sdk/anthropic

Interactive: pick the provider from the menu, then answer the prompts — base URL + API key + model for openai-compatible, API key + model for openai / anthropic — then the LLM speed (slow for a local LLM, which adds timeout:false / headerTimeout:false / chunkTimeout:120000 to the provider options; fast is the default) and the model limits (context / output, defaults 128000 / 32000).

Non-interactive (--yes), everything comes from env. Local OpenAI-compatible endpoint (Ollama / vLLM / Unsloth / ...):

OPENCODE_PROVIDER=openai-compatible \
OPENCODE_LLM_BASE_URL=http://127.0.0.1:11434/v1 \
OPENCODE_API_KEY=... \
OPENCODE_LLM_MODEL=qwen3.8-27b \
OPENCODE_LLM_SPEED=slow \
scripts/install.sh --yes

OpenAI (cloud):

OPENCODE_PROVIDER=openai OPENCODE_API_KEY=sk-... OPENCODE_LLM_MODEL=gpt-4o \
scripts/install.sh --yes

Anthropic (cloud):

OPENCODE_PROVIDER=anthropic OPENCODE_API_KEY=sk-ant-... \
OPENCODE_LLM_MODEL=claude-sonnet-4-5 scripts/install.sh --yes

Flags: --yes (non-interactive, uses env OPENCODE_PROVIDER / OPENCODE_LLM_BASE_URL / OPENCODE_API_KEY / OPENCODE_LLM_MODEL / OPENCODE_LLM_SPEED / OPENCODE_CONTEXT_LIMIT / OPENCODE_OUTPUT_LIMIT), --port N (default 4096), --skip-binary, --force-config, --dry-run, --skip-verify (skip the final health + smoke verification — useful for sandbox/CI).

UNSLOTH_API_KEY is still accepted as a deprecated fallback for OPENCODE_API_KEY (existing scripts keep working).

A new Hermes session is required after installation to load the MCP server.

Hermes integration (manual)

The installer patches ~/.hermes/config.yaml for you, but it does not install a Hermes skill on purpose (Hermes's skill layout may change). The package ships the full manual instead:

  • docs/hermes-integration.md — what the MCP is for, the exact config entry written, manual integration (by hand), the six tools, troubleshooting, uninstall.

  • docs/skill.example.md — a ready-to-copy Hermes skill (the delegation protocol) to drop into ~/.hermes/skills/ and adapt.

Usage

Hermes delegates work through the MCP tools — no manual CLI needed:

  • opencode_run(directory, task, agent) — submit a task; blocks until the turn completes, errors, or needs input. agent is required for a new session (a primary agent of the project, e.g. build, plan, or a project-specific agent).

  • When a tool returns state=needs_agent_input, Hermes decides: opencode_answer (pick exact option labels) or opencode_permission (once / always / reject) — both resume the same turn.

  • opencode_abort stops a stuck run; opencode_sessions lists sessions for a directory; opencode_inspect is for exceptional diagnostics only (never poll a running task).

The Hermes-side wiring (written by scripts/install.sh into ~/.hermes/config.yaml):

mcp_servers:
  opencode:
    command: ~/.local/bin/opencode-mcp-launch.sh
    enabled: true
    timeout: 14400
    connect_timeout: 30
    supports_parallel_tool_calls: false
timeouts:
  tools:
    sequential_call: 14400
    concurrent_batch: 14400

The launcher reads the OpenCode server credentials from ~/.config/hermes/opencode-server.json and execs python -m opencode_hermes_mcp.server in the repo venv — config.yaml stays secret-free.

Delegation journal

Every opencode_run is recorded in a durable, append-only JSONL journal so the delegation history survives sessions (the per-turn state file turn_<sid>.json is cleared on completion). One line per record:

{"ts": 1787750000123, "kind": "start", "session_id": "ses_...", "directory": "/abs/repo", "agent": "build", "task": "...(truncated to 500 chars)"}
{"ts": 1787750100456, "kind": "end", "session_id": "ses_...", "directory": "/abs/repo", "state": "completed|error|aborted|timeout", "elapsed_ms": 100333, "files": 12, "additions": 1209, "deletions": 18, "changed_files": ["a.py", "..."]}
  • Path: ~/.local/state/opencode-hermes-mcp/delegations.jsonl by default, overridable with the OPENCODE_HERMES_MCP_JOURNAL env var.

  • ts is epoch milliseconds; state is the run's terminal state; changed_files is truncated to 50 entries.

  • The journal is best-effort: a write failure (disk full, permissions) is logged and swallowed — it never fails a run.

  • Read-only access for consumers: opencode_hermes_mcp.journal.read_journal().

TUI attach helpers (watch OpenCode live)

install.sh also drops two helpers into ~/.local/bin/ (sources: scripts/helpers/):

ocattach <repo-abs> [ses_...]   # open the OpenCode TUI on a repo / session
oc-current                      # attach to the session Hermes is supervising NOW
  • ocattach opens the OpenCode TUI (opencode attach) against the permanent server :4096 — no tmux needed. Without a session id it opens the latest session / lets you pick one.

  • oc-current reads the newest ~/.local/state/opencode-hermes-mcp/turn_*.json (the controller's in-flight turn state) and attaches to that session — use it while Hermes is driving OpenCode, to watch the reasoning live.

Both read the server credentials from ~/.config/hermes/opencode-server.json (same source as the controller launcher). Do not press Esc/Ctrl+C in the TUI while a turn is active — that aborts the in-flight turn on the OpenCode side.

Upgrade / uninstall

scripts/upgrade.sh            # controller only: git pull + venv deps + restart + smoke
scripts/upgrade.sh --binary   # install the PINNED OpenCode binary (idempotent) — see "Version pin" below
scripts/uninstall.sh          # service, launchers, venv, hermes entry, credentials
scripts/uninstall.sh --purge  # + OpenCode provider config + API key secret
scripts/uninstall.sh --purge-binary  # + the OpenCode binary

uninstall.sh never touches the git clone, the OpenCode provider config, the API key secret, or the binary (unless the purge flags say so).

Version pin: OpenCode 1.18.21

The controller is validated against OpenCode 1.18.21 only (its endpoint contract was verified against that binary's live /doc, not the web docs). The pin is a single source of truth in opencode_hermes_mcp/pin.txt (one line, no v prefix): installer.py and scripts/upgrade.sh both read it, falling back to the built-in constant when the file is missing or empty (e.g. pip installs where the file is not shipped next to the code). install.sh pins the binary to that version; upgrade.sh never upgrades the binary by default.

scripts/upgrade.sh --binary (no version) installs the pinned version and is idempotent (no-op if the binary is already at the pin). --binary latest is the explicit opt-in to the bleeding edge; --binary X.Y.Z installs the requested version. For anything other than the pin, the script warns you and you MUST re-validate the controller before trusting it:

.venv/bin/python tests/run_tests.py

(all checks must pass; the suite drives the controller over MCP stdio against the live server). If it fails, pin back: scripts/upgrade.sh --binary.

Timeouts

Three independent timeouts bound the pipeline: the controller run timeout (DEFAULT_RUN_TIMEOUT = 3600 s — a single opencode_run/opencode_answer/ opencode_permission call gives up after an hour), the MCP server timeout in ~/.hermes/config.yaml (mcp_servers.opencode.timeout = 14400 s, connect_timeout = 30 s), and the Hermes tools timeouts (timeouts.tools.sequential_call / concurrent_batch = 14400 s) — the outer two are set 4x above the controller's so a long-but-healthy turn is never killed by the supervisor layer.

Development

See CONTRIBUTING.md for the dev setup, how to run the smoke test and the integration suite, and the contribution conventions.

Files

File

Role

opencode_hermes_mcp/server.py

FastMCP stdio server (the 6 tools)

opencode_hermes_mcp/controller.py

state machine: submit / wait / resume / classify

opencode_hermes_mcp/client.py

HTTP + SSE client for the OpenCode server

opencode_hermes_mcp/models.py

data helpers for turns / interactions

opencode_hermes_mcp/journal.py

durable delegation journal (append-only JSONL)

opencode_hermes_mcp/smoke_client.py

no-LLM smoke test (tool surface + basic calls)

tests/run_tests.py

full integration suite (live LLM turns)

tests/test_journal.py

journal unit tests (pytest)

opencode_hermes_mcp/installer.py

setup wizard (Python + rich; self-bootstrapping venv)

opencode_hermes_mcp/pin.txt

the OpenCode version pin (single source of truth, one line)

scripts/install.sh / uninstall.sh / upgrade.sh

lifecycle (install.sh is a thin wrapper around the wizard)

scripts/helpers/ocattach / oc-current

TUI attach helpers (installed to ~/.local/bin/)

License

MIT — Copyright (c) 2026 Arthur Hottier.

Available Tools

6 tools
opencode_abortA

Abort the active OpenCode session (or a specific one). Does not require the run lock, so it can stop a stuck run.

ParametersJSON Schema
NameRequiredDescriptionDefault
session_idNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.9/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It discloses that aborting does not require the run lock and can stop a stuck run, but omits critical side effects: whether the session is permanently terminated, whether in-progress work is lost, or any permission requirements. For a destructive operation like abort, this is a significant gap.

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

Conciseness5/5

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

Two sentences with zero waste. The primary action is front-loaded in the first sentence, and the lock detail is added as a compact second sentence that explains a key differentiator. No filler or redundancy.

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

Completeness3/5

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

An output schema exists, so return values do not need explanation. The description covers the parameter's semantics and the primary use case. However, it lacks edge-case handling: what happens if there is no active session, if the session is already terminated, or if the abort fails. For a tool with a single optional parameter, this is adequate but not fully complete.

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 description coverage is 0%, leaving session_id completely undefined in the schema. The description compensates by explaining that a null/omitted session_id targets the active session, while a specific value targets that session. This adds meaningful semantics beyond the bare type information, making the parameter's role clear.

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 specific verb 'Abort' with a clear resource ('OpenCode session') and distinguishes between the active session and a specific one via optional session_id. The mention of not requiring the run lock further sets it apart from siblings like opencode_sessions (which lists sessions) and opencode_run (which starts them), making its purpose unmistakable.

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?

Provides a concrete use case: stopping a stuck run that cannot be aborted normally because the run lock is held. This gives clear context for when to use the tool, but it does not explicitly name alternative tools for different scenarios (e.g., opencode_sessions for listing or opencode_run for starting). The guidance is useful but not exhaustive.

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

opencode_answerA

Answer a pending OpenCode question (state=needs_agent_input, kind=question) and keep blocking until the turn completes, errors, or needs input again.

  • answers: ONE entry per sub-question, in order. Each entry is a string or a list of strings. When a sub-question offers options and does not allow custom answers, each value MUST be an exact option label (the server rejects anything else — this tool validates before posting).

  • The answer is posted to OpenCode and the SAME turn resumes (the prompt is never resubmitted).

  • If the question is no longer pending (already answered/consumed), an error is returned; the turn may have moved on.

ParametersJSON Schema
NameRequiredDescriptionDefault
answersYes
timeoutNo
directoryYes
session_idYes
question_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations provided, the description carries full responsibility and does so excellently. It discloses blocking until completion/error/needs-input, that the prompt is never resubmitted, that answers are validated before posting, and error handling for stale questions. This provides substantial behavioral context beyond what any annotation might offer.

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

Conciseness5/5

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

The description is well-structured with a clear lead sentence and bullet points for details. Every sentence provides necessary information without redundancy. The format is easy to parse, front-loading the core purpose and then elaborating on behaviors and constraints.

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?

Given the moderate complexity and presence of an output schema (which covers return values), the description is quite complete. It explains blocking, resumption, validation, and error conditions. The only minor gap is not explicitly stating what happens on successful completion (e.g., turn continues), but that is implied by 'resumes' and covered by output schema. Adequate for an agent to call it correctly.

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 description coverage is 0%, so the description must compensate. It does a thorough job on the most complex parameter 'answers', explaining sub-question ordering, string/list-of-strings format, and exact label requirement for option-based questions. The other parameters (directory, session_id, question_id, timeout) are self-explanatory from names and standard context, so the description covers the critical semantics sufficiently.

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?

The description explicitly states the verb and resource: 'Answer a pending OpenCode question' with specific state and kind qualifications (state=needs_agent_input, kind=question). This clearly distinguishes it from sibling tools like opencode_run or opencode_inspect, which handle different actions. The purpose is unambiguous and specific.

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?

The description implies usage by specifying the condition for calling (pending question) and warns about the error if the question is no longer pending. It also notes the blocking behavior and that the same turn resumes. However, it does not explicitly mention alternatives or when NOT to use this tool, though the context makes it fairly clear it's for answering questions within an OpenCode session. The guidance is adequate but not exhaustive.

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

opencode_inspectA

DIAGNOSTIC ONLY: one-shot snapshot of a session (status, tree, pending permissions/questions, last assistant text). NEVER use this to poll or monitor a running task — opencode_run / opencode_answer / opencode_permission block until the turn ends; polling wastes tokens and is forbidden. Use only for exceptional diagnostics (after a timeout, or to inspect a session you did not start).

ParametersJSON Schema
NameRequiredDescriptionDefault
session_idNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and largely meets it: it discloses the one-shot, non-polling nature and frames the tool as a safe read-only diagnostic. It doesn't explicitly state the NULL session_id behavior or error case for nonexistent sessions, but the core behavioral profile (non-blocking, diagnostic-only, forbidden for monitoring) is well disclosed.

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 sentences, each functional: the first defines scope, the second forbids polling with rationale, the third specifies allowed use cases. The most important trait (DIAGNOSTIC ONLY) is front-loaded. Slightly long but no wasted words.

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?

An output schema exists, so return-value explanation is unnecessary. The description covers purpose, usage constraints, and behavioral traits thoroughly. The main missing piece is the NULL session_id semantics and what happens for sessions the caller did start or that don't exist — a small but real gap for a diagnostic 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 0% and there is only a single optional session_id parameter. The description partially compensates by implying session_id selects which session to inspect ('inspect a session you did not start'), but it never defines the parameter's format or what the default NULL value means (current session vs. most recent). This is a genuine gap given zero schema documentation.

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?

The description specifies a clear verb and resource ('one-shot snapshot of a session') and enumerates exactly what the snapshot contains (status, tree, pending permissions/questions, last assistant text). It clearly distinguishes itself from polling/monitoring tools, and the full-caps 'DIAGNOSTIC ONLY' prefix makes its role unmistakable.

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

Usage Guidelines5/5

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

This is exemplary. It explicitly forbids polling or monitoring, names the sibling tools (opencode_run / opencode_answer / opencode_permission) with the reason those are the correct choice (they block until turn ends), and specifies the only valid use cases: exceptional diagnostics after a timeout or inspecting a session you did not start. Nothing is left to inference.

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

opencode_permissionA

Decide a pending OpenCode permission (state=needs_agent_input, kind=permission) and keep blocking until the turn completes, errors, or needs input again.

  • reply: exactly one of 'once' (allow this call), 'always' (allow this pattern for the session), 'reject'. Decide as supervisor: allow normal actions necessary for the delegated task; reject destructive or out-of-scope requests.

  • The decision is posted to OpenCode and the SAME turn resumes (the prompt is never resubmitted).

  • If the permission is no longer pending, an error is returned.

ParametersJSON Schema
NameRequiredDescriptionDefault
replyYes
timeoutNo
directoryYes
session_idYes
permission_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.1/5.0
Behavior5/5

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

Despite no annotations, the description thoroughly discloses behavior: it blocks until turn completes/errors/needs input, the same turn resumes (prompt never resubmitted), and an error occurs if the permission is no longer pending. This goes well beyond the schema and gives the agent a clear model of execution.

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 well-structured with bullet points and front-loads the core purpose. It is concise and avoids fluff, though it could be slightly tightened (e.g., repeating 'keep blocking' in the first sentence and subsequent bullets). Overall, it is efficient and easy to scan.

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

Completeness3/5

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

While the tool's blocking and error behavior are explained, the description omits the return format of a successful decision and does not clarify the role of `timeout`. Given the tool's complexity (5 parameters, no annotations, and output schema present but not explained), this leaves important gaps for an agent deciding how long to wait or what to expect in response.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It explains the `reply` parameter thoroughly (values and semantics), but gives no meaning for `directory`, `session_id`, `permission_id`, or `timeout`. These are left to inference, which is insufficient for a tool with zero other documentation.

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?

The description states a specific action (decide a pending OpenCode permission) with clear context (state=needs_agent_input, kind=permission). It distinguishes itself from siblings by focusing on permission decisions, and includes explicit blocking behavior. The purpose is unambiguous and well-scoped.

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?

Provides clear decision policy: allow normal actions, reject destructive/out-of-scope requests, and defines the three reply options. However, it does not explicitly mention when not to use this tool or reference alternatives like opencode_abort or opencode_inspect, leaving some inference to the agent about tool selection.

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

opencode_runA

Delegate a coding task to OpenCode and block until it completes, errors, or needs input (a question or a permission).

  • New task: pass directory + task + agent (a new session is created). agent is REQUIRED for a new session.

  • Continuation / resume: pass session_id (+ task for a NEW turn on that session, or task is ignored when the turn is still in flight). agent is not needed to resume an in-flight turn (it is taken from the turn's durable state); pass it only when starting a fresh turn on an existing session.

  • agent: the OpenCode agent to run as root. Free string, validated dynamically against the project's live agent list (GET /agent). It MUST be a primary agent of that directory (project-specific primary agents are preferred when they fit the task; build is the generic implementation agent; plan is read-only). Subagents are rejected as root. Do not rely on the server's default_agent: always choose explicitly for a new session.

  • model: optional 'provider/model' override.

RESUME: if session_id is given and that session still has a turn in flight (busy/retry) — e.g. the controller restarted mid-turn — the prompt is NOT resubmitted: the wait loop simply resumes on the SAME turn (task and agent are ignored in that case).

The call blocks until the turn ends. While OpenCode works, NOTHING is polled — the controller watches SSE + REST internally. If OpenCode asks a question or requests a permission, the call returns state='needs_agent_input' (kind='question' or 'permission') with everything needed to decide; answer with opencode_answer / opencode_permission, which resume the SAME turn. Returns the final assistant text + diff on completion.

ParametersJSON Schema
NameRequiredDescriptionDefault
taskYes
agentNo
modelNo
timeoutNo
directoryYes
session_idNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full disclosure burden, and it excels. It discloses the blocking semantics, that 'NOTHING is polled — the controller watches SSE + REST internally', the needs_agent_input return state with kind='question' or 'permission', the RESUME behavior where 'the prompt is NOT resubmitted' for in-flight turns, and the final output (assistant text + diff). No contradiction with annotations since none exist.

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

Conciseness5/5

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

Long but every sentence earns its place for a 6-parameter stateful tool. It is front-loaded with the core blocking purpose, then uses clear scoping (RESUME: heading in caps, bulleted usage modes, bolded parameter names) that makes dense content scannable. The complexity of the state machine fully justifies the length.

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

Completeness5/5

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

Given 6 parameters, zero schema descriptions, and a complex state machine, the prose is remarkably complete: it covers new-task vs continuation, in-flight resume, root-agent restrictions, the question/permission return path, and the completion output. An output schema exists to carry return-value details, and the description handles everything an agent needs to invoke it correctly.

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

Parameters5/5

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

Schema description coverage is 0%, so the prose must carry parameter meaning, and it does comprehensively: 'agent' gets a rich treatment (root-only, validated against live list, subagents rejected, build vs plan semantics), 'session_id' gets the full resume/in-flight nuance, 'model' is the 'provider/model' override, and 'directory'+'task' are the new-task pair. The only mild gap is 'timeout', documented only by its schema default of 3600, but this is optional and self-evident.

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?

The opening sentence states a specific verb+resource: 'Delegate a coding task to OpenCode and block until it completes, errors, or needs input.' This clearly distinguishes the tool from its siblings (opencode_answer, opencode_permission, opencode_abort, opencode_inspect, opencode_sessions), which are named as complementary follow-ups rather than alternatives to run.

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

Usage Guidelines5/5

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

Provides explicit when-to-use guidance with exclusions: 'New task: pass directory + task + agent' vs. 'Continuation / resume: pass session_id', including the condition that 'task is ignored when the turn is still in flight' and that 'agent' is not needed to resume an in-flight turn. It also names the answer/permission siblings as the path for resuming a turn in needs_agent_input state. No inference is left to the agent.

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

opencode_sessionsB

List OpenCode sessions for a directory (to pick a session_id to reuse).

ParametersJSON Schema
NameRequiredDescriptionDefault
directoryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only says 'List', which implicitly suggests a read-only operation, but it does not state that explicitly, nor does it mention any side effects, authorization requirements, rate limits, or output format details. For a listing tool this is a minor gap, but the description fails to disclose even basic safety or scope constraints beyond the directory parameter.

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

Conciseness5/5

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

The description is a single sentence that is concise and front-loads the core action ('List OpenCode sessions for a directory'). The purpose hint is added in parentheses without verbosity. There is zero wasted content and the structure makes the tool's intent immediately clear.

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

Completeness3/5

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

For a simple list tool with only one parameter, the description conveys the essential information. However, since there are no annotations and schema descriptions are absent, it would benefit from mentioning prerequisites (e.g., OpenCode must be installed or the directory must exist) or clarifying the output structure. The presence of an output schema mitigates the need to explain return values, but behavioral details remain sparse.

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?

The schema description coverage is 0%, so the description must compensate for the undocumented 'directory' parameter. It does add meaning by explaining that the directory scopes the session listing, which is helpful. However, it does not specify the expected format (path, existence requirements, or any constraints) and offers no example. It partially compensates for the schema gap but not fully.

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 clearly states the action ('List') and the resource ('OpenCode sessions') with a scoping qualifier ('for a directory'). It also adds a purpose hint ('to pick a session_id to reuse'), which clarifies why an agent would call it. It is distinct from the sibling tool names (run, answer, etc.) without confusion, though it does not name any sibling explicitly, so it loses a point for not explicitly differentiating.

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

Usage Guidelines3/5

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

The description implies usage: it is meant to help pick a session_id for reuse, which suggests it is called before tools like opencode_run or opencode_answer. However, it does not explicitly state when to use this tool versus alternatives, nor does it mention any conditions or exclusions. The guidance is implied rather than explicit, which is adequate but not strong.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 6 tool updatesv0.4.1
    • First observedopencode_abort
    • First observedopencode_answer
    • First observedopencode_inspect
    • First observedopencode_permission
    • First observedopencode_run
    • First observedopencode_sessions

TDQS

A3.9/5.0
Disambiguation5/5

Each tool targets a distinct phase of the OpenCode lifecycle: running/resuming tasks, answering questions, deciding permissions, aborting, inspecting, and listing sessions. The two input-resolution tools are clearly separated by kind (question vs permission). No meaningful overlap exists.

Naming Consistency3/5

All tools share the opencode_ prefix, which helps, but the second element mixes verbs (run, answer, abort, inspect) with nouns (permission, sessions). There is no consistent verb_noun pattern, though the names remain readable and predictable enough within the server.

Tool Count5/5

Six tools cover the delegated-agent interaction loop without redundancy. Each tool earns its place, and the set is neither bloated nor too thin for the server's purpose.

Completeness4/5

The core lifecycle is well covered: start/resume tasks, respond to questions, grant or reject permissions, abort, inspect, and list sessions. The main gap is that agents cannot discover the available agent list through a tool, though generic agents like build/plan provide a usable fallback.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ArthurHtr/opencode-hermes-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server