Skip to main content
Glama

Delegate a task to OpenCode

opencode_task

Delegate a one-shot coding task to a subagent in a workspace, send a prompt, wait for completion, and return the answer with the transcript. Use for repo-specific requests needing a single run.

Instructions

One-shot delegation: create a session in a workspace, send a prompt, wait for the result, and return the answer plus the subagent transcript. Use this for 'have OpenCode do X in this repo' requests; use opencode_session_* when you need a persistent 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": {
      "prompt": "<prompt>"
    },
    "name": "opencode_task"
  }
}

Input Schema

NameRequiredDescriptionDefault
waitNoDefault true
agentNoAgent id (default general; try explore for read-only research)
modelNo
titleNo
promptYesWhat the agent should do
directoryNoAbsolute workspace; defaults to the client's directory
timeoutMsNoDefault 45000
parentSessionIDNoAttach the task as a subagent of this session

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=false, so the description carries most of the burden, and it does disclose the significant side effect: a session is created in a workspace and a prompt is dispatched. It omits what happens when wait=false or what the timeoutMs default (45000) means behaviorally, which keeps it short of a 5.

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, both earning their place: the first states the mechanism and return value, the second handles routing. Front-loaded with the lifecycle rather than burying it after caveats.

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 an 8-parameter, nested-schema delegation tool with no output schema, the description usefully explains the return value ('the answer plus the subagent transcript') and the session side effect. Remaining gaps — timeout semantics, non-waiting mode, and the meaning of parentSessionID — are real but modest given the schema documents them.

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 75% with 8 parameters, several self-documented. The description adds only indirect meaning — 'in a workspace' gestures at the directory parameter — and says nothing about agent selection, model variant, or parentSessionID subagent attachment beyond what the schema already states.

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?

Uses a specific verb-plus-resource framing ('One-shot delegation') and enumerates the full lifecycle: create session, send prompt, wait, return answer plus subagent transcript. This clearly separates it from the opencode_session_* family, which the description names explicitly as the alternative.

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?

Gives a concrete when-to-use trigger ('have OpenCode do X in this repo' requests) and an explicit when-not / alternative ('use opencode_session_* when you need a persistent conversation'). The routing decision is fully resolvable from the description alone.

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