Skip to main content
Glama

codex_run

Run a local OpenAI Codex CLI task synchronously with configurable model, sandbox, and cwd, returning final response, session ID, modified files, executed commands, and token usage.

Instructions

Run a task synchronously with local OpenAI Codex CLI (codex exec) using the model, reasoning effort, and sandbox configured in the Codex Bridge UI panel (unless explicitly overridden). Returns final response, session_id, modified files, executed commands, and token usage.

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

Input Schema

NameRequiredDescriptionDefault
cwdNoAbsolute path to the working directory where Codex should operate. Defaults to the active goal cwd or current workspace directory.
modelNoOptional model override for Codex. Omit to use the model selected in the Codex Bridge UI panel or ~/.codex/config.toml.
configNoOptional Codex config overrides in 'key=value' TOML format (passed as -c).
imagesNoOptional image file paths to attach to the prompt.
promptYesClear, detailed task instructions for Codex (supports multiline text and Chinese/English).
goal_idNoOptional persistent goal_id to associate this Codex execution with (auto-links session_id and iteration count).
profileNoOptional Codex config profile name (-p <profile>).
sandboxNoSandbox policy for Codex shell commands. Omit to use the active Codex Bridge UI panel setting.
add_dirsNoAdditional directories that should be writable alongside cwd.
worktreeNoIf true, run the session inside a managed Git worktree.
ephemeralNoIf true, do not persist the Codex session to disk.
milestone_idNoOptional milestone_id (e.g. 'm1') inside goal_id that this execution is working on.
output_schemaNoOptional path to a JSON Schema file constraining Codex's final response shape.
timeout_secondsNoMaximum seconds to wait before aborting (default 600).
reasoning_effortNoOptional reasoning effort override for Codex. Omit to use the level selected in the Codex Bridge UI panel or Codex default.
skip_git_repo_checkNoAllow Codex to run outside a Git repository (defaults to UI panel setting / true).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations at all, the description carries the full burden and does meaningful work: it declares the call is blocking/synchronous, discloses the return payload (final response, session_id, modified files, executed commands, token usage), and notes the default resolution of model/reasoning/sandbox from the UI panel. It stops short of covering auth requirements, concurrency/cost limits, or failure behavior for the long-running blocking call.

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?

Two sentences, front-loaded with the action and execution mode, followed by the return contract. No filler, no repetition of the title, and nothing that could be cut without losing information.

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?

For a 16-parameter tool with no output schema, the description supplies the missing return-value documentation and the default-resolution rule, which is what an agent most needs. The remaining gap is the absence of any behavioral context about the sibling execution tools, which matters for a family with start/resume/cancel variants.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all 16 parameters are already documented in structured data, including the omit-to-use-UI-default semantics for model, sandbox, and reasoning_effort. The description adds little beyond that: the 'configured in the Codex Bridge UI panel (unless explicitly overridden)' note restates what the schema already says per-parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Run a task synchronously with local OpenAI Codex CLI `codex exec`') plus what it returns. The word 'synchronously' implicitly separates it from the async siblings (codex_start/codex_resume), but no sibling is named, so the discrimination is inferred rather than stated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: 'synchronously' hints at the blocking-execution scenario and 'unless explicitly overridden' hints that defaults come from the UI panel. There is no explicit when-to-use / when-not-to-use guidance and no mention of codex_start, codex_resume, or codex_review as alternatives.

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