Generate images via the local Codex CLI
codex_generate_imageGenerate images from text prompts using the local Codex CLI. Returns saved file paths and inline previews, or a job ID to collect results when generation runs long.
Instructions
Generate images with the local Codex CLI. The prompt is passed through as written. Returns the saved file paths and shows the images inline, downscaling a preview when a file is too large to inline. Defaults to a fast low-quality 1024x1024 draft; raise quality for final assets. Image generation often takes longer than wait_sec, in which case this returns status: running and a job_id; call codex_job_result with it to collect the images.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| open | No | Open the generated images in the user's default image viewer. Default true, because MCP clients do not render tool-result images into the chat. | |
| size | No | Pixel size as WIDTHxHEIGHT, e.g. "1024x1024" (fastest, the default), "1536x1024" landscape, "1024x1536" portrait, or "auto". This is a request to Codex; the actual dimensions are reported in the result. | |
| count | No | How many images. Default 1. | |
| prompt | Yes | What the image should depict. | |
| quality | No | Generation quality. Default "low" - fastest, good for drafts. Use "high" for final assets. | |
| 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 | Workspace folder name. Defaults to a new folder. | |
| timeout_sec | No | Seconds before Codex is killed. |