Skip to main content
Glama
codex-mcp-tool

codex-mcp-tool

ask-codex

Destructive

Runs Codex CLI prompts for file analysis, multi-turn coding tasks, sandboxed workspace edits, and structured change output with model and safety controls.

Instructions

Execute Codex CLI with file analysis (@syntax), skills ($syntax), model selection, and safety controls. Supports changeMode.

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 local Ollama server (convenience for -c model_provider=oss). Requires Ollama running locally. Automatically sets sandbox to workspace-write if not specified.
yoloNo⚠️ Bypass all safety (dangerous)
imageNoOptional image file path(s) to include with the prompt
modelNoOptional model override. Known: gpt-6.1-sol, gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna. If omitted, uses your Codex CLI default (~/.codex/config.toml). Specify only to override.
configNoConfiguration overrides as 'key=value' string or object
promptYesTask or question. Use @ to include files (e.g., '@largefile.ts explain').
searchNoEnable web search using native --search flag (v0.52.0+). Requires network access - automatically sets sandbox to workspace-write if not specified.
addDirsNoAdditional writable directories beyond workspace (e.g., ["/tmp", "/var/log"]). Useful for monorepos and multi-directory projects.
profileNoConfig profile (-p <name>): layers $CODEX_HOME/<name>.config.toml over the base config. Legacy [profiles.<name>] tables in config.toml make the CLI refuse the run.
sandboxNoQuick automation mode: enables workspace-write with approval=never. Sandboxing remains active.
timeoutNoMaximum execution time in milliseconds (optional)
approvalNoDeprecated alias for approvalPolicy — both map to --ask-for-approval. Prefer approvalPolicy. Values: on-request, never
fullAutoNoCompatibility alias for workspace-write with approval=never (not --yolo)
ephemeralNoRun without persisting Codex session files to disk
sessionIdNoSession ID for conversation continuity. Enables native Codex resume.
changeModeNoReturn structured OLD/NEW edits for refactoring
chunkIndexNoChunk index (1-based)
workingDirNoWorking directory for execution
ignoreRulesNoIgnore user and project execpolicy .rules files for this run
personalityNoCommunication style: pragmatic (concise, machine-friendly), friendly (conversational) or none (no personality instructions)
sandboxModeNoAccess: read-only, workspace-write, danger-full-access
outputSchemaNoJSON Schema path or inline schema to constrain output format (Codex CLI v0.95.0+)
resetSessionNoClear session context before execution. Starts fresh conversation.
responseModeNoResponse verbosity: "clean" returns only the final answer (default), "full" returns the complete execution log including thinking, tool calls, and agent activityclean
strictConfigNoFail when config.toml contains fields unknown to the installed Codex CLI
chunkCacheKeyNoCache key for continuation
localProviderNoSpecify which local provider to use (lmstudio or ollama). Automatically enables --oss if not set. If omitted with --oss, uses config default or shows selection.
approvalPolicyNoApproval policy (-a): never, on-request. Note: non-interactive `codex exec` runs report `approval: never` even with on-request, since nobody can answer a prompt.
enableFeaturesNoEnable feature flags (repeatable). Equivalent to -c features.<name>=true
bypassHookTrustNoDANGEROUS: run enabled hooks without persisted hook trust
disableFeaturesNoDisable feature flags (repeatable). Equivalent to -c features.<name>=false
includeMetadataNoInclude configuration metadata in response
includeThinkingNoInclude reasoning/thinking section in response
reasoningEffortNoReasoning depth. Omit to use the CLI default. max/ultra are model-dependent GPT-6/GPT-5.6 options; ultra may delegate to subagents.
ignoreUserConfigNoIgnore $CODEX_HOME/config.toml for this run; authentication is still loaded
skipGitRepoCheckNoSkip git repository validation. Useful for non-git directories (Codex CLI v0.75.0+)
outputLastMessageNoWrite final Codex message to file path. Useful for CI/CD result capture (Codex CLI v0.95.0+)
toolOutputTokenLimitNoMaximum tokens for tool outputs (100-10,000). Controls response verbosity.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.7.0

TDQS

C2.9/5.0
Behavior2/5

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

Annotations already declare destructiveHint=true and openWorldHint=true, so the safety profile is partly carried by structured data. The description's contribution is a vague phrase, "safety controls," and it never states that the tool can modify files in the working directory, requires an authenticated Codex CLI, or how long runs typically take. For a 39-parameter destructive executor, this leaves the agent with little behavioral context beyond the annotations.

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?

Two sentences, front-loaded with the action and resource, with no filler. The trailing fragment "Supports changeMode" is redundant with the schema's own changeMode property and reads as an afterthought, but the overall text is tight.

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

Completeness2/5

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

With 39 parameters, seven enums, destructive and open-world annotations, and no output schema, the description should explain at least what a run produces and what side effects to expect. Instead it covers roughly four capability keywords and omits return behavior, session/resume semantics, and the danger of yolo/sandboxMode escalation, leaving the definition under-specified for the tool's complexity.

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 nearly every parameter is already documented, which sets the baseline at 3. The description adds one genuinely new detail: the $syntax for invoking skills, since the schema only documents @ for files. That is a modest increment over the schema rather than a meaningful elaboration of the parameter set.

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?

The description names a specific verb and resource ("Execute Codex CLI") and enumerates the capability areas it covers: file analysis, skills, model selection, safety controls. An agent can tell this is the general-purpose Codex invocation tool. It stops short of naming siblings like batch-codex or review-changes, so the boundary with those is left implicit.

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

Usage Guidelines2/5

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

There is no guidance on when to reach for this tool versus batch-codex, brainstorm, do-act, or review-changes, and no stated prerequisites or exclusions. The only usage hints are the inline @ and $ syntaxes, which describe how to format a prompt rather than when to choose this tool.

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