Skip to main content
Glama
codex-mcp-server
by etheaven

ask-codex

Analyze, review, edit, or generate code with OpenAI Codex, get a second opinion on changes, and reference files via @ syntax; edits stay read-only unless sandbox is enabled.

Instructions

Use OpenAI Codex to analyze, review, edit, or generate code. Call this tool whenever the user mentions "codex", "use codex", or wants a second opinion from OpenAI models on code. Supports file references with @ syntax (e.g. @src/), model selection (see list-models), reasoning effort, and structured edits via changeMode. Read-only by default; set sandbox: true to let Codex edit files. For reviewing git changes prefer the review tool.

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": "ask-codex"
  }
}

Input Schema

NameRequiredDescriptionDefault
cdNoWorking directory
ossNoUse a local open-source model provider (Codex --oss, e.g. Ollama or LM Studio running locally).
yoloNo⚠️ Bypass all safety (dangerous)
imageNoOptional image file path(s) to include with the prompt
modelNoOptional model ID, passed straight to Codex CLI (-m). Omit to use the default from ~/.codex/config.toml (recommended). Do not guess IDs: call the list-models tool to see the models this Codex install offers.
configNoConfiguration overrides as 'key=value' string or object
promptYesTask or question. Use @ to include files (e.g., '@largefile.ts explain').
searchNoEnable live web search (Codex --search). Does not change the sandbox.
profileNoConfiguration profile to use from ~/.codex/config.toml
sandboxNoLet Codex edit files in the working directory (sandbox workspace-write). Alias for fullAuto.
timeoutNoMaximum execution time in milliseconds. Default: CODEX_MCP_TIMEOUT_MS env var, else 600000 (10 min).
approvalNoApproval policy: untrusted, on-failure, on-request, never
fullAutoNoLet Codex edit files in the working directory (sandbox workspace-write)
changeModeNoReturn structured OLD/NEW edits for refactoring
chunkIndexNoChunk index (1-based)
workingDirNoWorking directory for execution
sandboxModeNoAccess: read-only, workspace-write, danger-full-access
chunkCacheKeyNoCache key for continuation
approvalPolicyNoApproval: never, on-request, on-failure, untrusted
enableFeaturesNoEnable feature flags (repeatable). Equivalent to -c features.<name>=true
disableFeaturesNoDisable feature flags (repeatable). Equivalent to -c features.<name>=false
includeMetadataNoInclude configuration metadata in response
includeThinkingNoInclude reasoning/thinking section in response
reasoningEffortNoOptional reasoning effort (model_reasoning_effort). Common values: low, medium, high, xhigh, max; some models also take none, minimal or ultra. Support varies per model: list-models shows the levels each model accepts. Omit to use the model/config default.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changedv1.4.0
    • changedInput schema / properties / fullAuto / description
      Previous value: -"Full automation mode"New value: +"Let Codex edit files in the working directory (sandbox workspace-write)"
    • changedInput schema / properties / model / description
      Previous value: -"Model ID to use. IMPORTANT: Use exact IDs listed below, do NOT invent or modify model names. Recommended (use in this order): gpt-5.4 (default, best), gpt-5.3-codex (best coding),   gpt-5.3-codex-spark (instant, Pro only), gpt-5.2-codex, gpt-5.2, gpt-5.1-codex-max,   gpt-5.1-codex, gpt-5.1, gpt-5, gpt-5-mini, gpt-5-nano. Large context (1M): gpt-4.1, gpt-4.1-mini, gpt-4.1-nano."New value: +"Optional model ID, passed straight to Codex CLI (-m). Omit to use the default from ~/.codex/config.toml (recommended). Do not guess IDs: call the list-models tool to see the models this Codex install offers."
    • addedInput schema / properties / model / minLength
      Added value: +1
    • changedInput schema / properties / oss / description
      Previous value: -"Use local Ollama server (convenience for -c model_provider=oss). Requires Ollama running locally. Automatically sets sandbox to workspace-write if not specified."New value: +"Use a local open-source model provider (Codex --oss, e.g. Ollama or LM Studio running locally)."
    • changedInput schema / properties / reasoningEffort / description
      Previous value: -"Reasoning effort level. Controls depth of internal reasoning. Values: none, minimal, low, medium (default), high, xhigh. Higher = deeper analysis but slower and more expensive. Not all models support all levels. gpt-5.4 supports: none/low/medium/high/xhigh. gpt-5.3-codex supports: low/medium/high/xhigh. o3/o4-mini support: low/medium/high."New value: +"Optional reasoning effort (model_reasoning_effort). Common values: low, medium, high, xhigh, max; some models also take none, minimal or ultra. Support varies per model: list-models shows the levels each model accepts. Omit to use the model/config default."
    • removedInput schema / properties / reasoningEffort / enum
      Removed value: -[
      -  "none",
      -  "minimal",
      -  "low",
      -  "medium",
      -  "high",
      -  "xhigh"
      -]
    • addedInput schema / properties / reasoningEffort / minLength
      Added value: +1
    • changedInput schema / properties / sandbox / description
      Previous value: -"Quick automation mode: enables workspace-write + on-failure approval. Alias for fullAuto."New value: +"Let Codex edit files in the working directory (sandbox workspace-write). Alias for fullAuto."
    • changedInput schema / properties / search / description
      Previous value: -"Enable web search by activating web_search_request feature flag. Requires network access - automatically sets sandbox to workspace-write if not specified."New value: +"Enable live web search (Codex --search). Does not change the sandbox."
    • changedInput schema / properties / timeout / description
      Previous value: -"Maximum execution time in milliseconds (optional)"New value: +"Maximum execution time in milliseconds. Default: CODEX_MCP_TIMEOUT_MS env var, else 600000 (10 min)."
    • addedInput schema / properties / timeout / exclusiveMinimum
      Added value: +0
    • changedInput schema / properties / timeout / type
      Previous value: -"number"New value: +"integer"
  2. First observedv1.3.9

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the safety burden well: it states the tool is read-only by default and that sandbox: true is required to allow file edits, which is the critical behavioral fact for an agent. It also mentions changeMode producing structured OLD/NEW edits. It does not address the many overlapping aliases (sandbox/fullAuto/sandboxMode, cd/workingDir, approval/approvalPolicy) or the chunking/continuation behavior, which is the main remaining gap.

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?

Four compact sentences, front-loaded with purpose and trigger, then capabilities, then the read-only safety default and the sibling redirect. Dense but every clause carries information; the one weak spot is that capability enumeration (file refs, model, reasoning, changeMode) is somewhat list-like rather than prioritized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 24-parameter tool with no annotations and no output schema, the description covers the core invocation path and the read-only-vs-edit decision, which is the most important thing. However, it omits the chunking workflow (chunkIndex, chunkCacheKey, and the fetch-chunk sibling) and the alias/duplicate parameter relationships, leaving a nontrivial portion of the surface unexplained.

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 every one of the 24 parameters is already documented, making 3 the baseline. The description adds marginal value by surfacing @-file references, model selection via list-models, reasoning effort, and changeMode, but says nothing about the chunkIndex/chunkCacheKey continuation pair or how the alias parameters relate.

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 opening sentence names a specific verb set (analyze, review, edit, generate) and the resource (code) plus the backing engine (OpenAI Codex). It also explicitly distinguishes itself from the sibling review tool and points to list-models, so an agent can separate it from alternatives without opening the schema.

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 an explicit trigger ('whenever the user mentions "codex", "use codex", or wants a second opinion from OpenAI models on code') and an explicit exclusion with a redirect ('For reviewing git changes prefer the review tool'). Model discovery is also routed to list-models, leaving little to inference.

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