Skip to main content

Codex Tools API

The Codex MCP server exposes three tools.

codex

Send a prompt to OpenAI Codex for code generation or analysis.

Parameters

ParameterTypeRequiredDescription
promptstringYesThe prompt to send to Codex

Response

Plain text string with Codex's response.

Example

Input:

{
"prompt": "Write a TypeScript function that debounces an async function and returns the result of the last invocation"
}

code_review

Send a diff for structured review. Uses agent instructions from ~/.codex/agents/code-reviewer.toml if available.

Parameters

ParameterTypeRequiredDescription
diffstringYesThe git diff to review (max 500KB)
contextstringNoAdditional context for the review

Response

JSON when the response is parseable, otherwise plain text. The JSON structure matches:

interface ReviewResult {
verdict: "APPROVED" | "NEEDS_REVISION";
issues: ReviewIssue[];
suggestions: string[];
}

codex_reply

Continue a previous conversation.

Parameters

ParameterTypeRequiredDescription
conversation_idstringYesIdentifier for the conversation
replystringYesThe follow-up message

Response

Plain text string with Codex's response.

note

This tool is stateless. The conversation_id is passed as context to Codex but the server does not maintain conversation state between calls.