Skip to main content
Glama
Claude Code × OpenCode

Claude Code × OpenCode

by AXLdev123

Delegate a task to OpenCode

oc_delegate

Delegate a fully briefed coding task to an autonomous OpenCode sub-agent with its own files, shell, web, and skill tools; get back the answer, tools used, changed files, and cost.

Instructions

Hand a task to an OpenCode agent (an autonomous sub-agent with its own tools: files, shell, web, MCP, skills). Creates a new session (or continues session_id), picks model/agent/skills, waits for the end and returns the answer, the tools used, the files changed and the cost. Write a complete brief: the agent cannot see your conversation.

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": {
      "task": "<task>"
    },
    "name": "oc_delegate"
  }
}

Input Schema

NameRequiredDescriptionDefault
forkNoWith session_id: fork the session (copy its history) before continuing.
taskYesThe complete brief for the task.
waitNotrue (default): wait for the end and return the result. false: start in the background and return the session_id.
agentNoPrimary OpenCode agent (build, plan, general, or a custom agent). See oc_catalog what=agents.
filesNoFile paths (or URIs) to attach to the message.
modelNoModel: "provider/model", "provider/model#variant" (e.g. "opencode/claude-sonnet-5-5#high") or just an id/name ("deepseek-v4.1-flash-free"). Empty = OpenCode's default model.
titleNo
agentsNoSub-agents to mention (@agent) in the message.
detailNofinal = answer only; summary (default) = answer + tools + files; full = complete transcript of the turn.
skillsNoIds of OpenCode skills to attach to the message (see oc_catalog what=skills).
commandNoOpenCode slash command to run instead of a free prompt (e.g. "review", "init"). `task` then becomes its arguments.
directoryNoAbsolute working directory (project). Default: the OpenCode service's directory.
timeout_sNoMax wait in seconds (default 900). Past it, the task keeps running and oc_wait picks it up.
session_idNoContinue an existing session instead of creating one.
permissionsNoPermissions: "auto" (default, everything allowed), "readonly" (no writes, no shell), "agent" (the agent's own rules; requests surface through oc_pending) or explicit rules.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A3.8/5.0
Behavior4/5

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

With zero annotations the description carries the full burden and does well: it discloses that a session is created or reused, that the call blocks until completion, and exactly what is returned (answer, tools used, files changed, cost). The warning that the sub-agent cannot see the caller's conversation is behavioral context an agent would otherwise get wrong. It does not state that the delegated agent can write files or run shell beyond the mention of its tools, nor permission implications, which keeps it at 4.

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?

Four compact sentences, front-loaded with the core action before mechanics, and no filler. The dense parenthetical about the sub-agent's tools is slightly crowded but earns its place by conveying autonomy and capability scope.

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?

For a 15-parameter, no-output-schema tool, the description supplies what the schema cannot: that the call is blocking by default, what the return contains, and that the sub-agent is isolated from the conversation. Combined with the highly documented schema, an agent has enough to invoke this correctly on the first try.

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 93%, so the schema already documents session_id, model, agent, skills and the rest in detail. The description only restates the high-level selection set (model/agent/skills) and session continuation. It adds no gloss on fork, detail levels, permissions modes, or command semantics beyond what the schema strings say, so the baseline 3 applies.

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?

"Hand a task to an OpenCode agent" names the verb and the resource, and the follow-on sentence enumerates the mechanics (new session or continued session_id, model/agent/skills selection, blocking wait, return payload). An agent can tell this is the single-task delegation entry point. It stops short of explicitly contrasting itself with oc_delegate_parallel or oc_send, so it lands below a 5.

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 line "Write a complete brief: the agent cannot see your conversation" is a genuine usage instruction, and the wait/timeout text implies when to go synchronous vs background. But there is no explicit when-to-use vs oc_delegate_parallel, oc_send, or oc_answer, and no stated prerequisites or exclusions. Guidance is implied rather than spelled out.

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