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
| Name | Required | Description | Default |
|---|---|---|---|
| cd | No | Working directory | |
| oss | No | Use a local open-source model provider (Codex --oss, e.g. Ollama or LM Studio running locally). | |
| yolo | No | ⚠️ Bypass all safety (dangerous) | |
| image | No | Optional image file path(s) to include with the prompt | |
| model | No | 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. | |
| config | No | Configuration overrides as 'key=value' string or object | |
| prompt | Yes | Task or question. Use @ to include files (e.g., '@largefile.ts explain'). | |
| search | No | Enable live web search (Codex --search). Does not change the sandbox. | |
| profile | No | Configuration profile to use from ~/.codex/config.toml | |
| sandbox | No | Let Codex edit files in the working directory (sandbox workspace-write). Alias for fullAuto. | |
| timeout | No | Maximum execution time in milliseconds. Default: CODEX_MCP_TIMEOUT_MS env var, else 600000 (10 min). | |
| approval | No | Approval policy: untrusted, on-failure, on-request, never | |
| fullAuto | No | Let Codex edit files in the working directory (sandbox workspace-write) | |
| changeMode | No | Return structured OLD/NEW edits for refactoring | |
| chunkIndex | No | Chunk index (1-based) | |
| workingDir | No | Working directory for execution | |
| sandboxMode | No | Access: read-only, workspace-write, danger-full-access | |
| chunkCacheKey | No | Cache key for continuation | |
| approvalPolicy | No | Approval: never, on-request, on-failure, untrusted | |
| enableFeatures | No | Enable feature flags (repeatable). Equivalent to -c features.<name>=true | |
| disableFeatures | No | Disable feature flags (repeatable). Equivalent to -c features.<name>=false | |
| includeMetadata | No | Include configuration metadata in response | |
| includeThinking | No | Include reasoning/thinking section in response | |
| reasoningEffort | No | 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. |