Skip to main content
Glama
codex-local-mcp

codex-local-mcp

by ossmalaysia

Generate images via the local Codex CLI

codex_generate_image

Generate images from text prompts with the local Codex CLI, returning saved file paths and inline previews. For longer runs, return a job ID to collect results later.

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.

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_generate_image"
  }
}

Input Schema

NameRequiredDescriptionDefault
openNoOpen the generated images in the user's default image viewer. Default true, because MCP clients do not render tool-result images into the chat.
sizeNoPixel 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.
countNoHow many images. Default 1.
modelNoOverride the Codex model for this image task.
promptYesWhat the image should depict.
qualityNoGeneration quality. Default "low" - fastest, good for drafts. Use "high" for final assets.
wait_secNoSeconds 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.
workspaceNoWorkspace folder name. Defaults to a new folder.
backgroundNoRequested image background. Use PNG or WebP for transparency.
timeout_secNoSeconds before Codex is killed.
output_formatNoRequested saved format. Default JPEG for smaller opaque images.
target_file_kbNoTarget KB per image, default 256. A prompt preference; actual size is reported.
reasoning_effortNoCodex reasoning effort, subject to model support.
output_compressionNoRequested JPEG or WebP output quality, 1 to 100. Default 80. PNG is lossless.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.10.0
    • addedInput schema / properties / background
      Added value: +{
      +  "description": "Requested image background. Use PNG or WebP for transparency.",
      +  "enum": [
      +    "opaque",
      +    "transparent",
      +    "auto"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / model
      Added value: +{
      +  "description": "Override the Codex model for this image task.",
      +  "type": "string"
      +}
    • addedInput schema / properties / output_compression
      Added value: +{
      +  "description": "Requested JPEG or WebP output quality, 1 to 100. Default 80. PNG is lossless.",
      +  "maximum": 100,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / output_format
      Added value: +{
      +  "description": "Requested saved format. Default JPEG for smaller opaque images.",
      +  "enum": [
      +    "png",
      +    "jpeg",
      +    "webp"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / reasoning_effort
      Added value: +{
      +  "description": "Codex reasoning effort, subject to model support.",
      +  "enum": [
      +    "default",
      +    "none",
      +    "minimal",
      +    "low",
      +    "medium",
      +    "high",
      +    "xhigh"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / target_file_kb
      Added value: +{
      +  "description": "Target KB per image, default 256. A prompt preference; actual size is reported.",
      +  "maximum": 10240,
      +  "minimum": 16,
      +  "type": "integer"
      +}
  2. Changed1 schema field changedv0.2.0
    • addedInput schema / properties / wait_sec
      Added value: +{
      +  "description": "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.",
      +  "type": "number"
      +}
  3. Changed2 schema fields changed
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / size / description
      Previous value: -"Pixel size, e.g. \"1024x1024\" (fastest, the default), \"1536x1024\" landscape, \"1024x1536\" portrait, \"2048x2048\", \"3840x2160\"."New value: +"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."
  4. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does substantial work: it discloses return values (saved file paths plus inline previews, with downscaling when too large), the default low-quality 1024x1024 draft, and the async status:running + job_id fallback. It omits cost, permission requirements, and where files land, which keeps it short of a 5.

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?

Four sentences, all load-bearing, with the core purpose front-loaded and the async fallback last where an agent will look for it. Dense but not padded; no restatement of the tool name.

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?

For a 14-parameter generation tool with no output schema, the description covers the essentials: what is returned, how long it waits, and what to do on timeout. It leaves the relationship between timeout_sec and wait_sec and the workspace folder behavior unexplained, which are the remaining gaps.

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 the schema already documents all 14 parameters thoroughly, including defaults and enum meanings. The description adds only marginal meaning beyond that ('the prompt is passed through as written', the wait_sec → job_id interaction), which is correctly a baseline 3.

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?

Opens with a specific verb+resource ('Generate images with the local Codex CLI') and immediately distinguishes itself from siblings by naming codex_job_result for the async continuation. The agent can tell this apart from codex_run or codex_read_artifact without opening any schema.

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?

Gives concrete usage guidance: defaults are for fast drafts, 'raise quality for final assets', and explicitly says to call codex_job_result with the job_id when the call times out. It does not say when to prefer codex_run over this tool for image work, but the guidance present is actionable.

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