Ask opencode (new session)
opencode_askSends 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
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Optional 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. | |
| watch | No | If 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. | |
| prompt | Yes | Question or instruction for opencode. | |
| sandbox | No | Permission 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_s | No | Max seconds to wait for opencode to complete. Default 300. | |
| workspace | No | Working root (the run directory). Defaults to the server cwd. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |