Skip to main content
Glama
OpenCode V2 MCP Bridge
by ddarkwing

Run an OpenCode agent task

oc_task

Create a fresh OpenCode session for an agent, send a prompt, and wait for completion. Returns final text with session id, cost, and token usage.

Instructions

Create a fresh OpenCode session for the given agent (and optional model override), send a prompt, and by default wait for completion. Returns the agent's final text plus session id, cost and token usage. If OPENCODE_FORCE_MODEL is set on the bridge, that model is always used.

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": {
      "prompt": "<prompt>"
    },
    "name": "oc_task"
  }
}

Input Schema

NameRequiredDescriptionDefault
agentNoAgent id from oc_agents (e.g. build, plan, reviewer)
modelNoModel override as "provider/model" or "provider/model#variant"
titleNoSession title
promptYesTask or question for the agent
directoryNoAbsolute project directory
backgroundNoReturn immediately with a session id instead of waiting
timeoutSecondsNoMax wait time in seconds (default 50, keeps calls under typical MCP client timeouts)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.9/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full disclosure burden, and it does well: it says a fresh session is created, that the call blocks by default, what the return payload contains (final text, session id, cost, token usage), and that OPENCODE_FORCE_MODEL silently overrides the model argument. It omits what happens on timeout expiry and whether the session survives for later resumption.

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?

Three tight sentences, front-loaded with the core action, then the return contract, then the environment caveat. No filler.

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?

With no output schema, describing the return values is essential and the description does it, plus it covers the env-var override. The remaining gap is the interaction between timeoutSeconds, background mode, and what a truncated call yields, which an agent invoking a long-running task would want to know.

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 100%, so baseline is 3; the description adds real meaning beyond the schema by framing 'model' as an optional override that can be silently superseded by the OPENCODE_FORCE_MODEL environment variable, and by tying the blocking/background behavior to the default wait semantics.

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 uses specific verbs and resources: 'Create a fresh OpenCode session', 'send a prompt', 'wait for completion'. 'Fresh session' implicitly distinguishes it from the sibling oc_reply, which continues an existing session, but that sibling is not named, so the differentiation is only implied.

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?

It states the default behavior (wait for completion) and implies the alternative (background returns immediately with a session id). However, it gives no explicit when-to-use guidance relative to oc_reply or oc_sessions, and it does not say when to prefer background mode.

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