Skip to main content
Glama

Ask Codex (new session)

codex_ask

Run a new OpenAI Codex sub-agent in an OS sandbox for complex reasoning and real code work; pass a workspace so it sees the repo, then continue the session with follow-up calls.

Instructions

Best for the hardest reasoning and real code work, behind a REAL OS sandbox (OpenAI Codex, codex exec), in a NEW session. Pass workspace=; without it the sub-agent sees no repo. Follow up with codex_continue. Uses your Codex login (ChatGPT or API key). Read-only by default; sandbox="workspace-write" lets it edit. On Windows the bridge flags refused commands and a silent read-only downgrade with an [agent-intern] WARNING in the answer: treat such an answer as unsourced. 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": "codex_ask"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNoOptional model override (`-m`); omit to use codex's configured default.
watchNoIf true, open a live "watch" view in your browser that streams codex's steps (reasoning, the commands it runs, file changes) from its `--json` event stream. codex still runs headless; the same final text is returned. Best-effort — if the browser can't open, the run completes normally. Default false.
effortNoOptional reasoning effort for this call (`-c model_reasoning_effort`): "low", "medium", "high" or "xhigh" (codex's own list; "minimal" on some models). Omit to use the level in your codex config.
promptYesQuestion or instruction for Codex.
sandboxNoFilesystem policy, enforced by an OS sandbox: "read-only" (default: reads and answers, writes nothing), "workspace-write" (may edit files in the workspace), or "danger-full-access" (no sandbox, avoid). There is no approval gate, so this is the safety boundary. On Windows, workspace-write runs read-only unless `[windows] sandbox = "unelevated"` is set in ~/.codex/config.toml (see codex_status), and refused commands leave codex answering unsourced; the bridge appends an [agent-intern] WARNING in both cases.read-only
timeout_sNoMax seconds to wait for codex to complete. Default 180.
workspaceNoWorking root for the session (`-C`). Defaults to the server cwd.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.38.0
    • addedInput schema / properties / effort
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Optional reasoning effort for this call (`-c model_reasoning_effort`):\n    \"low\", \"medium\", \"high\" or \"xhigh\" (codex's own list; \"minimal\" on some\n    models). Omit to use the level in your codex config."
      +}
  2. Changed1 schema field changedv0.37.1
    • changedInput schema / properties / sandbox / description
      Previous value: -"Filesystem policy — \"read-only\" (default: reads and answers but\n     writes nothing), \"workspace-write\" (may edit files under the\n     workspace), or \"danger-full-access\" (no sandbox — avoid). `codex\n     exec` has no interactive approval gate, so this is the real safety\n     boundary; opt into write access deliberately.\n\n     WINDOWS CAVEAT (codex 0.149.1-0.162.1): sandboxed runs there currently\n     refuse EVERY command, both policies, down to `pwd` — codex's\n     policy engine cannot classify the `pwsh -Command <...>` wrapper it\n     builds. Shell commands are how codex reads files, so it sees none\n     of the workspace and ANSWERS ANYWAY, from its own knowledge or a\n     web search, with no hint that it read nothing. The bridge appends\n     a visible \"[agent-intern] WARNING\" to any answer whose run had\n     commands refused: if you see it, treat the answer as unsourced."New value: +"Filesystem policy, enforced by an OS sandbox: \"read-only\" (default:\n     reads and answers, writes nothing), \"workspace-write\" (may edit\n     files in the workspace), or \"danger-full-access\" (no sandbox, avoid).\n     There is no approval gate, so this is the safety boundary. On Windows,\n     workspace-write runs read-only unless `[windows] sandbox =\n     \"unelevated\"` is set in ~/.codex/config.toml (see codex_status), and\n     refused commands leave codex answering unsourced; the bridge appends\n     an [agent-intern] WARNING in both cases."
  3. Changed1 schema field changedv0.33.0
    • changedInput schema / properties / sandbox / description
      Previous value: -"Filesystem policy — \"read-only\" (default: reads and answers but\n     writes nothing), \"workspace-write\" (may edit files under the\n     workspace), or \"danger-full-access\" (no sandbox — avoid). `codex\n     exec` has no interactive approval gate, so this is the real safety\n     boundary; opt into write access deliberately.\n\n     WINDOWS CAVEAT (codex 0.149.1): sandboxed runs there currently\n     refuse EVERY command, both policies, down to `pwd` — codex's\n     policy engine cannot classify the `pwsh -Command <...>` wrapper it\n     builds. Shell commands are how codex reads files, so it sees none\n     of the workspace and ANSWERS ANYWAY, from its own knowledge or a\n     web search, with no hint that it read nothing. The bridge appends\n     a visible \"[agent-intern] WARNING\" to any answer whose run had\n     commands refused: if you see it, treat the answer as unsourced."New value: +"Filesystem policy — \"read-only\" (default: reads and answers but\n     writes nothing), \"workspace-write\" (may edit files under the\n     workspace), or \"danger-full-access\" (no sandbox — avoid). `codex\n     exec` has no interactive approval gate, so this is the real safety\n     boundary; opt into write access deliberately.\n\n     WINDOWS CAVEAT (codex 0.149.1-0.162.1): sandboxed runs there currently\n     refuse EVERY command, both policies, down to `pwd` — codex's\n     policy engine cannot classify the `pwsh -Command <...>` wrapper it\n     builds. Shell commands are how codex reads files, so it sees none\n     of the workspace and ANSWERS ANYWAY, from its own knowledge or a\n     web search, with no hint that it read nothing. The bridge appends\n     a visible \"[agent-intern] WARNING\" to any answer whose run had\n     commands refused: if you see it, treat the answer as unsourced."
  4. Changed1 schema field changedv0.28.0
    • changedInput schema / properties / sandbox / description
      Previous value: -"Filesystem policy — \"read-only\" (default: reads and answers but\n     writes nothing), \"workspace-write\" (may edit files under the\n     workspace), or \"danger-full-access\" (no sandbox — avoid). `codex\n     exec` has no interactive approval gate, so this is the real safety\n     boundary; opt into write access deliberately."New value: +"Filesystem policy — \"read-only\" (default: reads and answers but\n     writes nothing), \"workspace-write\" (may edit files under the\n     workspace), or \"danger-full-access\" (no sandbox — avoid). `codex\n     exec` has no interactive approval gate, so this is the real safety\n     boundary; opt into write access deliberately.\n\n     WINDOWS CAVEAT (codex 0.149.1): sandboxed runs there currently\n     refuse EVERY command, both policies, down to `pwd` — codex's\n     policy engine cannot classify the `pwsh -Command <...>` wrapper it\n     builds. Shell commands are how codex reads files, so it sees none\n     of the workspace and ANSWERS ANYWAY, from its own knowledge or a\n     web search, with no hint that it read nothing. The bridge appends\n     a visible \"[agent-intern] WARNING\" to any answer whose run had\n     commands refused: if you see it, treat the answer as unsourced."
  5. Addedv0.12.2

TDQS

A4.3/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, openWorldHint=true and idempotentHint=false, yet the description adds substantial context beyond them: the OS-sandbox safety boundary, the read-only default, `workspace-write` enabling edits, and the Windows silent-downgrade/[agent-intern] WARNING behavior that makes answers unreliable. Note that readOnlyHint=false alongside a read-only default is not a contradiction — the tool can write when `sandbox="workspace-write"` is set — but the description would be stronger if it explained that the safe default is why the hint is false. Timeout default is stated; return-format is covered by the output schema.

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?

Front-loads the single most decision-relevant fact ('Best for the hardest reasoning and real code work', new session) and then packs setup, safety, and failure-mode guidance into a short block. Parenthetical asides are dense but each carries operational information; nothing 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?

For a 7-parameter, open-world, potentially-mutating delegation tool, the description covers the setup prerequisite (workspace), the safety boundary (sandbox), the authentication source (Codex login), the failure mode (Windows downgrade), and the follow-up path. With an output schema present, return values needn't be explained, so nothing essential is missing.

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, but the description adds real meaning: it warns that omitting `workspace=<project dir>` leaves the sub-agent with no repo, which is a usage consequence the schema ('Defaults to the server cwd') does not convey. `sandbox` and `timeout_s` are re-explained but largely duplicate schema text.

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?

Names a concrete verb+resource (delegate a prompt to OpenAI Codex via `codex exec`), states the scope ('in a NEW session'), and explicitly contrasts with the sibling `codex_continue` for follow-ups. An agent can distinguish it from the many other *_ask tools by the 'hardest reasoning / real code work / OS sandbox' framing.

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?

Gives clear conditions for use (hardest reasoning, real code work), an explicit alternative for the follow-up case (`codex_continue`), and a caution ('Autonomous agent: trusted prompts only'). It stops short of saying when to prefer a different vendor's ask tool or `codex_status`, so it is strong but not a complete when/when-not map.

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