Skip to main content
Glama
ossmalaysia

codex-local-mcp

by ossmalaysia

Generate images via the local Codex CLI

codex_generate_image

Generate 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

TableJSON 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.
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.
timeout_secNoSeconds before Codex is killed.

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +}
  2. 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."
  3. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It reveals that the prompt is passed verbatim, that results include file paths and inline previews with downscaling for oversized files, that generation often exceeds wait_sec returning a status and job_id, and how to retrieve results. It also discloses defaults and quality trade-offs. This is exceptionally transparent for a tool with zero annotation support.

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 five sentences, each earning its place: the core action, the pass-through behavior, the return format, the default quality guidance, and the asynchronous fallback. It front-loads the primary purpose and packs essential behavioral details without redundancy or fluff.

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

Completeness5/5

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

For a tool with 8 parameters, 100% schema coverage, and no output schema, the description covers everything an agent needs: the synchronous/asynchronous split, how to handle long runs, the default quality and size, and the inline display behavior. Sibling tools are correctly referenced for follow-up, and the description is self-sufficient for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so a baseline of 3 applies. The description adds value by explaining the practical impact of quality (draft vs. final), the wait_sec/job_id behavior, and the inline preview downscaling. It doesn't rehash schema definitions but provides usage-level meaning for key parameters, exceeding the baseline.

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 opens with a specific verb and resource: 'Generate images with the local Codex CLI.' It clearly differentiates from siblings (codex_job_result, codex_read_artifact, codex_run) by focusing on image generation, while the others handle results, artifacts, and generic execution. The scope is unambiguous and an agent can immediately tell this tool's purpose.

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 provides clear operational context: it explains the default draft behavior, quality guidance for final assets, and explicitly tells the agent to call codex_job_result when a job_id is returned. However, it does not explicitly state when to avoid this tool or when to prefer a sibling (e.g., 'use codex_run for non-image tasks'), though the name and content make that implicit. This is a minor gap, so not a perfect 5.

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