Skip to main content
Glama

opencode_run_agent

Execute an AI coding agent with a prompt, either as a background job with polling or synchronously with a timeout.

Instructions

Run an opencode agent with a prompt.

Launches as background job; returns job_id for polling. Set wait=true to block until done.

Return Format

{"success": bool, "message": str, "data": {"job_id": str, "status": str}}

Examples

opencode_run_agent(prompt="Refactor main.py", wait=False) opencode_run_agent(prompt="Summarize README", format="json", wait=True, timeout=120)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
waitNoWait for completion (true) or return immediately with job_id (false)
formatNoOutput format: 'text' or 'json'text
promptYesThe prompt/message to send to the opencode agent
projectNoProject directory path (optional)
timeoutNoMax seconds to wait when wait=true (default 300)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

The annotation readOnlyHint=false already indicates the tool is not read-only. The description adds valuable behavioral context by explaining that it launches a background job, returns a job_id, and can optionally block with wait=true. It also shows the return format. However, it does not mention potential side effects of running an agent (e.g., file modifications), which could be relevant for an agent-executing tool.

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 and concise: a one-line purpose, a brief behavior note, a return format section, and two examples. Every section is purposeful and there is no wasted text. The use of a code block for the return format and examples improves scannability.

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 tool's complexity (5 parameters, output schema), the description covers the purpose, behavioral model, return format, and usage examples. It is mostly complete. Minor gaps include not explaining how to use the returned job_id with sibling polling tools, and not explicitly describing the 'status' values in the return format. However, the output schema and examples mitigate these gaps.

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 100%, so all parameters are already documented. The description adds value through examples that illustrate parameter usage (e.g., setting wait=False, format='json', timeout=120). The examples clarify how parameters interact, such as using timeout only when wait=true. This goes beyond the schema's individual parameter descriptions.

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 clearly states the tool's purpose: 'Run an opencode agent with a prompt.' This is a specific verb+resource pairing that distinguishes it from sibling tools like opencode_list_runs (listing), opencode_get_run_status (status), and opencode_cancel_run (cancellation). The additional detail about launching as a background job further clarifies the unique behavior.

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 provides clear context on how to use the tool: it returns a job_id for polling, and set wait=true to block until done. Examples demonstrate typical usage with wait and timeout. However, it does not explicitly exclude alternatives or mention when to use a sibling tool instead, such as opencode_get_run_status for checking job progress.

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

Install Server

Other Tools

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/sandraschi/opencode-cli-mcp'

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