Skip to main content
Glama

Execute a task with Codex

codex_execute

Executes a plan or task in a workspace using Codex, returns session ID, agent message, file changes, and commands run.

Instructions

Start a new Codex session that executes a plan/task in the given workspace. Returns sessionId (keep it to send review feedback later), agent message, file changes and commands run.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdYesAbsolute path of the workspace Codex should work in
modelNoCodex model override, e.g. gpt-5.1-codex
promptYesTask or plan for Codex to execute (can embed full plan text)
sandboxNoCodex sandbox policy (default: workspace-write)workspace-write
terminalNoOpen a Terminal window streaming live progress (default: env CODEX_MCP_TERMINAL=1)
timeoutMsNoMax execution time per attempt in ms; auto-resume may add attempts (default: 60 minutes)
writeNotesNoPersist a markdown summary of this run to <cwd>/.codex-flow/notes/<sessionId>.md (default false).
reasoningEffortNoReasoning effort override for the selected model

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
diffYes
runIdYes
usageYes
errorsYes
statusYes
stderrYes
abortedYes
liveLogYes
attemptsNo
commandsYes
exitCodeYes
timedOutYes
warningsYes
notesPathYes
sessionIdYes
turnCountYes
attributionYes
fileChangesYes
parseErrorsYes
agentMessageYes
resumeReasonsNo
sawCompletionYes
schemaVersionYes
unknownEventsYes
outputTruncatedYes
Behavior3/5

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

No annotations are provided, so the description must fully disclose behavior. It mentions the returned sessionId for later feedback but does not detail potential destructive actions, authentication requirements, or the implications of the different sandbox levels. The description is partially helpful but leaves important behavioral traits unstated.

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?

The description is concise with two sentences—first stating purpose, second listing outputs. It is front-loaded and contains no extraneous information. However, it could be slightly more structured (e.g., separating purpose and return value).

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?

Given the tool's complexity (8 parameters, 2 required) and the presence of an output schema, the description provides adequate context for primary usage. However, it does not elaborate on the meaning of optional parameters like model, reasoningEffort, or writeNotes beyond what the schema offers.

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?

All parameters have schema descriptions (100% coverage), so the description adds minimal extra meaning. It repeats some defaults but does not clarify parameter usage beyond the schema. Baseline 3 is appropriate since schema already covers the parameters.

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 description clearly states the tool starts a new Codex session to execute a plan/task in the given workspace, and lists the key return values (sessionId, agent message, file changes, commands). It is specific and distinguishes from sibling tools like codex_continue or codex_metrics.

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?

The description explains the tool's function but does not explicitly guide when to use it vs. alternatives like codex_continue (for resuming) or codex_review. Usage context is implied by sibling names but not spelled out.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/anhnguyen0905/codex-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server