Skip to main content
Glama

Generate an image with Codex

codex_generate_image
Destructive

Generate an image from a text prompt and save it to a specified output path. Returns the file path instead of image bytes, so the result can be used directly in workflows.

Instructions

Generate an image using the image_gen tool built into Codex, and save it to output_path. No API key is needed: it runs through your Codex session. Returns the path of the file written, not the image bytes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoWorking directory for the run. Must sit inside the server allowlist. Defaults to the first allowed root.
sizeNoRequested size, e.g. "1024x1024", "1536x1024", "3840x2160".
modelNoModel slug, e.g. "gpt-5.5". Defaults to the Codex configuration.
styleNoStyle or medium, e.g. "flat minimal vector", "studio product photography".
configNoRaw Codex config overrides as key=value, TOML-parsed, e.g. 'model_reasoning_effort="high"'.
enableNoCodex feature flags to enable for this run.
imagesNoImage files to attach to the prompt. Each must be inside the allowlist.
promptYesWhat the image should show. Plain language; the server wraps it in the spec Codex expects.
disableNoCodex feature flags to disable for this run.
sandboxNoSandbox for commands Codex runs. "read-only" forbids writes, "workspace-write" (default) allows writes inside the workspace, "danger-full-access" removes all limits and is refused unless the server was started with CODEX_MCP_ALLOW_DANGEROUS=1.
use_caseNoTaxonomy slug steering the style: product-mockup, ui-mockup, logo-brand, illustration-story, infographic-diagram, photorealistic-natural, stylized-concept, ads-marketing.
worktreeNoRun in a fresh managed git worktree instead of the working directory.
ephemeralNoDo not persist the session to disk. It cannot be resumed afterwards.
constraintsNoThings the image must avoid or preserve, e.g. "no text, no watermark".
output_pathYesWhere to write the image, e.g. "assets/hero.png". Must sit inside the server allowlist.
transparentNoAsk for a genuinely transparent background and preserve the alpha channel.
output_schemaNoPath to a JSON Schema file constraining the shape of the agent final response.
timeout_secondsNoHow long to wait inline before handing back a job_id and continuing in the background. 0 means return immediately. Defaults to the server setting (120s).
reference_imagesNoReference images for style or composition. Each must be inside the allowlist.
skip_git_repo_checkNoAllow running outside a git repository.
dangerously_bypass_approvals_and_sandboxNoRemove every approval and sandbox check. Refused unless CODEX_MCP_ALLOW_DANGEROUS=1.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.4

TDQS

A4.2/5.0
Behavior4/5

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

Annotations declare destructiveHint=true and readOnlyHint=false, which are consistent with the description's write action. The description adds useful context beyond annotations: it explains that no API key is needed and that the return is the file path, not image bytes. It does not contradict the annotations, and it adds meaningful behavioral detail without being exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise (three sentences), front-loaded with the core action, and includes only high-value details (no API key, return path). There is no wasted wording or repetition, making it highly efficient for an agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 21 parameters and 2 required, the schema carries the full param documentation, so the description only needs to provide overarching context. It does that, and since there is no output schema, it correctly explains the return format. It could mention background execution or job_id behavior, but that is already in the timeout_seconds parameter description. The description is adequate given the schema richness, though a note on returning a job_id would push it higher.

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?

Schema description coverage is 100%, so every parameter has a documented description. The tool description does not add any parameter-specific information beyond that. Per the baseline guidance, when coverage is high, a score of 3 is appropriate. The description's mention of output_path and return path aligns with the schema but adds no new semantics.

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 states a specific action (generate an image), the mechanism (using the image_gen tool built into Codex), and the output (save to output_path). It also clarifies the return value (path, not bytes), which makes the tool's function unambiguous and distinguishes it from the non-image sibling tools like codex_exec or codex_review.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not explicitly compare to siblings, but the clear purpose and the mention that no API key is needed (it runs through your Codex session) provide enough context for when to use it. There are no explicit exclusions or alternatives named, but the tool's focused role makes usage obvious, so it earns a 4 rather than a 5.

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