Skip to main content
Glama

Ask opencode (new session)

opencode_ask

Ask an AI agent to solve a coding question or task in a new session and receive its final answer. Works with free hosted models or your own API key, with optional project context.

Instructions

Ask opencode (opencode run) a question or task in a NEW session.

The one backend here that needs NO subscription: opencode's own free hosted models (opencode/*-free, see opencode models) answer with zero credentials configured, so this works on a machine that has never logged in to anything. Add a key with opencode auth login for Claude/GPT-class models. Returns the agent's final message, reconstructed from opencode's --format json events. Point workspace at a project dir for context-aware answers.

⚠️ The free models are SLOW (queue-scheduled — a one-word answer has taken minutes), which is why timeout_s defaults to 300 here. Prefer a configured paid model for anything long, and don't mistake slowness for a hang.

Input Schema

TableJSON 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, applied via opencode's OPENCODE_PERMISSION and enforced by the agent on every platform alike: "read-only" (default — no edit/bash/subagent/network tools, `.env` files denied), "workspace-write" (edit and shell inside the workspace; reaching outside it is denied), or "danger-full-access" (opencode's own `--auto`, no policy — avoid). ⚠️ Agent-enforced, NOT an OS boundary: a determined tool call is refused by opencode, not by the kernel. For a hard boundary, use codex.read-only
timeout_sNoMax seconds to wait for opencode to complete. Default 300.
workspaceNoWorking root (`--dir`). Defaults to the server cwd.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.30.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations state readOnlyHint=false, openWorldHint=true, and idempotentHint=false, and the description substantially supplements these by explaining auth requirements, the slowness of free queue-scheduled models, timeout_s rationale, and sandbox enforcement being agent-enforced rather than an OS boundary. It also warns against 'danger-full-access' and clarifies that a refused tool call is blocked by opencode, not the kernel.

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?

The description is longer than average but remains dense and well-organized, front-loading the core purpose before covering credentials, output format, workspace usage, and performance warnings. Every sentence carries operational value; the only reason not to give 5 is that some caveats, such as the slowness warning, are also reflected in the sandbox and timeout parameter descriptions.

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 tool with open-world capabilities, auth options, sandbox policies, and performance caveats, the description covers the critical ground: no-subscription backend, paid model alternatives, final-message return value, workspace context, timeout behavior, and sandbox limitations. An output schema exists, so detailed return shape doesn't need to be restated. There is no major operational gap.

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 baseline is 3. The description adds useful extra meaning beyond the schema: workspace is recommended for context-aware answers, timeout_s defaults to 300 because free models are slow, and model selection guidance encourages a paid model for long tasks. These additions genuinely help an agent choose parameter values.

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 opens with a specific verb and resource: 'Ask opencode (`opencode run`) a question or task in a NEW session.' It clearly distinguishes itself from continuation tools by explicitly stating 'NEW session' and describes what the tool returns (the agent's final message reconstructed from event data).

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 gives concrete usage context: the free opencode models require zero credentials, a project directory can be pointed to for context-aware answers, and configured paid models are preferred for long tasks. It also mentions 'For a hard boundary, use codex' as an alternative. However, it does not explicitly name or contrast sibling ask tools like codex_ask, copilot_ask, or antigravity_ask.

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