Skip to main content
Glama

Ask opencode (new session)

opencode_ask

Sends a prompt to opencode as an autonomous sub-agent and returns its answer, using free models with no credentials; pass a workspace so it sees your repo, then follow up to continue.

Instructions

Best for users with no subscription: opencode's free opencode/*-free models answer with zero credentials, in seconds (opencode run, NEW session). Also for a model family no other backend covers: opencode auth login adds Claude/GPT-class models. Pass workspace=; without it the sub-agent sees no repo. Follow up with opencode_continue. Its sandbox is agent-enforced, not an OS boundary; timeout_s defaults to a 300 s ceiling. Autonomous agent: trusted prompts only.

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_ask"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNoOptional model id (`-m`, "provider/model" — e.g. "opencode/nemotron-3.5-lightning-free"); validated against `opencode models` and rejected on a typo. Omit for opencode's configured default.
watchNoIf true, open a live "watch" view streaming opencode's steps from the same `--format json` event stream. Same final text is returned. Best-effort. Default false.
promptYesQuestion or instruction for opencode.
sandboxNoPermission policy opencode enforces itself, the same on every OS (agent-enforced, NOT an OS boundary; codex has a real one): "read-only" (default: no edit/shell/subagent/web tools, `.env` reads denied), "workspace-write" (edits and shell), or "danger-full-access" (`--auto`, no policy, avoid). On 1.x workspace-write refuses paths outside the workspace. On 2.x file edits stay inside it, but the shell is not confined: it can write anywhere and read `.env` files.read-only
timeout_sNoMax seconds to wait for opencode to complete. Default 300.
workspaceNoWorking root (the run directory). Defaults to the server cwd.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.37.1
    • changedInput schema / properties / sandbox / description
      Previous value: -"Permission policy, applied via opencode's OPENCODE_PERMISSION and\n     enforced by the agent on every platform alike: \"read-only\"\n     (default — no edit/bash/subagent/network tools, `.env` files\n     denied), \"workspace-write\" (edit and shell inside the workspace;\n     reaching outside it is denied), or \"danger-full-access\"\n     (opencode's own `--auto`, no policy — avoid).\n     ⚠️ Agent-enforced, NOT an OS boundary: a determined tool call is\n     refused by opencode, not by the kernel. For a hard boundary, use\n     codex."New value: +"Permission policy opencode enforces itself, the same on every OS\n     (agent-enforced, NOT an OS boundary; codex has a real one):\n     \"read-only\" (default: no edit/shell/subagent/web tools, `.env` reads\n     denied), \"workspace-write\" (edits and shell), or \"danger-full-access\"\n     (`--auto`, no policy, avoid). On 1.x workspace-write refuses paths\n     outside the workspace. On 2.x file edits stay inside it, but the\n     shell is not confined: it can write anywhere and read `.env` files."
    • changedInput schema / properties / workspace / description
      Previous value: -"Working root (`--dir`). Defaults to the server cwd."New value: +"Working root (the run directory). Defaults to the server cwd."
  2. Addedv0.30.0

TDQS

A4.6/5.0
Behavior4/5

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

The description adds real behavior beyond the annotations: zero-credential operation, sub-second-ish latency expectations, `opencode auth login` as a model-expansion path, and a safety warning ('Autonomous agent: trusted prompts only'). Some of its sandbox and 300 s timeout content restates what the input schema already documents, so it is not maximally additive, but 'agent-enforced, not an OS boundary' sharpens the risk picture that the `openWorldHint`/`readOnlyHint:false` pair only gestures at.

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?

It is front-loaded with the strongest selection signal (free models, no credentials) and every clause carries information. It is slightly breathless with backticked commands, parentheticals, and figure-dashes packed into one paragraph, but no sentence is filler.

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?

With 6 parameters at 100% schema coverage, plus an output schema and annotations, the description only needs to cover what the structured data cannot: when to pick this backend, the credential story, the continuation path, and the sandbox/trust caveat. All four are present, so an agent has enough to call it correctly and to reason about safety.

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 the 3 baseline is already met by the structured fields. The description still adds meaning the schema does not: that omitting `workspace` leaves the sub-agent blind to the repo, and that the sandbox distinction matters because codex has a real OS boundary while this does not. That is genuine invocation-relevant semantics, though `model` and `watch` get no treatment in the description.

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 names the concrete action (run `opencode run` in a NEW session), the audience it serves (users with no subscription / free `opencode/*-free` models with zero credentials), and explicitly separates itself from `opencode_continue` for follow-ups. An agent can distinguish this from every sibling `*_ask` tool by the zero-credential, model-coverage framing alone.

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?

It gives two positive selection conditions ('no subscription', 'a model family no other backend covers') and names the follow-up tool (`opencode_continue`) rather than leaving the continuation path implicit. The 'Pass workspace=<project dir>' instruction plus the warning about what breaks without it is a precondition stated in the guidance itself.

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