Run a task with the local Codex CLI
codex_runDelegate natural-language coding tasks to the local Codex CLI, returning output and created files or a job ID to collect longer runs.
Instructions
Hand a natural-language task to the local Codex CLI coding agent. Codex can write and run code, install packages and call APIs inside an isolated workspace folder, then this returns its output plus any files it created. If Codex takes longer than wait_sec, this returns status: running and a job_id instead; call codex_job_result with it to collect the result.
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": "codex_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Override the Codex model for this run. | |
| prompt | Yes | The task for Codex, written as you would to a developer. | |
| wait_sec | No | Seconds to wait for the result before returning a job_id instead. Default 45, maximum 50, which keeps the call under common 60-second client timeouts. | |
| workspace | No | Relative workspace folder name under the workspace root. Reuse the same name to continue working on the same files. Defaults to a new timestamped folder. | |
| timeout_sec | No | Seconds before Codex is killed. Default 300. | |
| reasoning_effort | No | Model reasoning effort. Supported values depend on the model. |