Skip to main content
Glama

gpt-image-2-mcp

An MCP server that exposes OpenAI's gpt-image-2 (released 2026-04-21) to any MCP client — Claude Desktop, Claude Code, Cursor, MCP Inspector, etc.

Seven tools:

Tool

What it does

generate_image

text → image

edit_image

1–8 reference images (+ optional mask) → image

get_image_job

poll a backgrounded generate/edit job by job_id

start_edit_session

begin an iterative multi-turn edit

continue_edit_session

apply another refinement turn — previous output becomes the new input

end_edit_session

release a session

list_edit_sessions

show active sessions

Every generated image is saved to disk and returned inline so the calling model sees it.

Requirements

  • Node.js ≥ 20

  • An OpenAI API key on an org with gpt-image-2 access (Organization Verification may be required)

Related MCP server: gpt-image-2-mcp

Install

pnpm install
pnpm run build

This produces build/index.js, which is the server entry point.

Configure a client

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "gpt-image-2": {
      "command": "node",
      "args": ["/absolute/path/to/gpt_image_2_mcp/build/index.js"],
      "env": {
        "OPENAI_API_KEY": "sk-..."
      }
    }
  }
}

Claude Code

Either add to ~/.claude.json under mcpServers with the same shape, or drop an .mcp.json next to your project:

{
  "mcpServers": {
    "gpt-image-2": {
      "command": "node",
      "args": ["/absolute/path/to/gpt_image_2_mcp/build/index.js"],
      "env": { "OPENAI_API_KEY": "sk-..." }
    }
  }
}

MCP Inspector (interactive testing)

pnpm run inspect

Launches the official inspector UI pointed at your local build.

Environment variables

Var

Required

Purpose

OPENAI_API_KEY

Auth

OPENAI_BASE_URL

Override for proxies / enterprise routes

OPENAI_ORG_ID

Forwarded as organization

OPENAI_PROJECT_ID

Forwarded as project

GPT_IMAGE_2_OUTPUT_DIR

Global default for where images are saved. Absolute paths used as-is, relative resolved from CWD.

GPT_IMAGE_2_MCP_DEBUG

Set to 1 to emit verbose debug logs on stderr.

GPT_IMAGE_2_SESSION_MAX

Max concurrent in-memory edit sessions, LRU-evicted beyond this (default 20; 0 = no cap).

GPT_IMAGE_2_SESSION_TTL_MS

Idle TTL before an edit session is swept (default 3600000 = 1h; 0 = never expire).

GPT_IMAGE_2_ASYNC_AFTER_MS

Sync window before generate_image / edit_image background themselves (default 20000; <= 0 disables backgrounding entirely). See Background jobs below.

GPT_IMAGE_2_JOB_MAX

LRU cap on finished image jobs kept for polling (default 20; 0 = no cap).

GPT_IMAGE_2_JOB_TTL_MS

Age before a finished job becomes un-pollable (default 1800000 = 30 min; 0 = never expire). Running jobs are never expired or evicted.

OPENAI_FORCE_RESPONSES_EDITS

Set to 1 to pin edits to the Responses-API fallback route instead of /v1/images/edits. See Edit routing below.

OPENAI_RESPONSES_EDIT_MODEL

Host model used by the Responses-API fallback edit route (default gpt-4.1-mini). See Edit routing below.

Where images go

Unless overridden, each tool writes to:

<OS config dir>/gpt-image-2-mcp/output/<project-name>-<hash>/
  • macOS/Linux: ~/.config/gpt-image-2-mcp/output/<project>-<hash>/

  • Windows: %APPDATA%\gpt-image-2-mcp\output\<project>-<hash>\

<project>-<hash> is derived from the git root (if any) or the current working directory — each project gets its own folder so generations don't collide.

Per-call override: pass output_dir: "/some/path" to any tool.

Filenames look like image-20260422-150301-a1b2c3.png. If you pass filename_prefix: "hero-banner", it becomes image-20260422-150301-a1b2c3-hero-banner.png.

What the tools return

Every tool result contains:

  1. An inline ImageContent block per generated image (so the LLM sees the image)

  2. A text summary: applied settings, file path, token usage, estimated cost

  3. structuredContent for programmatic consumers:

{
  "model": "gpt-image-2",
  "prompt": "…",
  "requested": { "size": "auto", "quality": "auto", "n": 1, "format": "png" },
  "applied":   { "size": "1024x1024", "quality": "high", "background": "opaque", "output_format": "png" },
  "images": [ { "file_path": "…", "filename": "…", "size_bytes": 123456, "mime_type": "image/png" } ],
  "usage":   { "input_tokens": …, "output_tokens": …, "total_tokens": …, "input_tokens_details": { … } },
  "cost_usd_estimated": 0.2112
}

Session tools additionally return session_id and turn.

Background jobs (long generations)

Through slow proxy routes, large sizes, or high quality, a single gpt-image-2 call can run for minutes — far past the tool-call timeout of many MCP hosts. generate_image and edit_image therefore race their API request against a 20-second sync window (GPT_IMAGE_2_ASYNC_AFTER_MS):

  • Fast path — the request finishes inside the window and the tool responds exactly as before. No change for quick edits or fast routes.

  • Background path — the response returns immediately (~at the window) with { job_id, state: "running" }, while the request continues in-process. Keep calling get_image_job with that job_id every few seconds:

    • state: "running" → keep polling

    • state: "completed" → content is identical to a synchronous success: inline images, summary text with file paths / usage / cost, and structuredContent.images

    • state: "failed"error carries the reason; content mirrors the error

Job state lives in memory: finished jobs are kept up to GPT_IMAGE_2_JOB_MAX and expire after GPT_IMAGE_2_JOB_TTL_MS; a server restart drops all jobs.

Models

generate_image, edit_image, start_edit_session, and continue_edit_session accept an optional model argument:

  • gpt-image-2 — the default

  • gpt-image-2.5-flare

  • gpt-image-2.5-sunburst

The 2.5 variants accept the same parameters (sizes, quality, formats). Omitting model keeps using gpt-image-2; in an edit session, continue_edit_session inherits the model the session was started with unless you override it per turn. Token/cost estimates assume gpt-image-2 pricing.

Sizes

Default is auto (the model picks). You can pass:

  • A preset: 1024x1024, 1536x1024, 1024x1536

  • Any custom WxH where:

    • Both edges are multiples of 16

    • Max edge ≤ 3840px (outputs above 2K are beta)

    • Aspect ratio within 1:3 and 3:1

    • Total pixels between 655,360 and 8,294,400

Invalid sizes fail before the API call with a clear error — no wasted requests.

background: "transparent" is NOT supported by gpt-image models. Use a model that supports it if you need alpha.

Iterative editing example

start_edit_session    prompt: "A coastal lighthouse at dawn, photorealistic", images: ["./sketch.png"]
  → session_id: edit-1761149123-a1b2c3d4, turn 1, saved to …/session-…-turn1.png

continue_edit_session session_id: "edit-…-a1b2c3d4", prompt: "Make the sky more orange. Keep everything else the same."
  → turn 2

continue_edit_session session_id: "edit-…-a1b2c3d4", prompt: "Add a small boat on the horizon."
  → turn 3

end_edit_session      session_id: "edit-…-a1b2c3d4"

Sessions are in-memory only and discarded on server restart — this is intentional (keeps the server stateless on the wire) and mirrors the Gemini MCP pattern.

Image inputs for edit_image and start_edit_session

Accepts any mix of:

  • Absolute path: /Users/me/photo.png

  • Relative path: ./photo.png (resolved from CWD)

  • file:///Users/me/photo.png

  • https://example.com/photo.png (downloaded, size-capped)

  • data:image/png;base64,iVBOR…

Up to 8 images per call. Each ≤ 50MB. PNG/WEBP/JPG supported.

Cost guardrails

The server ships no hard spending limits — you should watch your OpenAI usage dashboard. Each tool result includes an estimated cost in USD computed from the token usage returned by the API, plus an approximate pre-flight estimate logged to stderr.

Rough per-image cost at common sizes:

Quality

1024×1024

1024×1536 / 1536×1024

low

~$0.006

~$0.005

medium

~$0.053

~$0.041

high

~$0.211

~$0.165

Custom sizes scale with pixel count. Edit calls additionally tokenize input images at high fidelity — large reference images are expensive.

Edit routing

edit_image, start_edit_session, and continue_edit_session call POST /v1/images/edits directly. This is the canonical endpoint: it supports n > 1, masks, and returns accurate per-call token usage for cost estimation.

History: at launch (2026-04-21) the endpoint rejected gpt-image-2 (and gpt-image-1.5) with 400 Invalid value: 'gpt-image-2'. Value must be 'dall-e-2'. — an OpenAI-side bug. Versions ≤ 0.2.0 of this server therefore routed edits through the Responses API by default. OpenAI fixed the endpoint silently in early May 2026 (verified live 2026-06-11), and since 0.3.0 the direct endpoint is the default again.

The Responses-API workaround is kept as a fallback (src/utils/edit-via-responses.ts):

  • It engages automatically if the direct endpoint ever returns the launch-era 400 again (matched narrowly; the rejection is remembered for 10 minutes so only the first call in that window pays the failed attempt, then the direct endpoint is re-probed).

  • Set OPENAI_FORCE_RESPONSES_EDITS=1 to pin it explicitly.

  • The legacy OPENAI_USE_DIRECT_EDITS toggle from 0.2.0 is deprecated and ignored (its only meaningful setting was 1 — opt into the direct endpoint, which is now the default).

Fallback mechanics: input images are uploaded via the Files API (purpose: "vision"), a cheap host model (default gpt-4.1-mini, override with OPENAI_RESPONSES_EDIT_MODEL) is forced to invoke the image_generation tool, the base64 result is extracted, and uploaded files are deleted afterwards.

Fallback trade-offs versus the direct endpoint (only apply when the fallback is active — the tool result carries route: "responses" and a note when they do):

  • n > 1 is not supported — the Responses path returns one image per call.

  • Cost accounting undercounts — usage only reports the host chat model's text tokens; the image tool is billed separately (~$0.04–0.05 extra for a 1024×1536 medium edit).

  • Masks still work — uploaded and referenced via input_image_mask.file_id.

Troubleshooting

  • "OPENAI_API_KEY is not set" — add it to the env block of your MCP config.

  • 403 / organization verification — gpt-image-2 may require Organization Verification on your OpenAI org. Check the dashboard.

  • 429 — you hit the IPM (images per minute) cap for your tier. Lower n, or wait.

  • Image doesn't appear in the client — check the file path in the text block; the image is saved regardless of inline display.

  • Protocol disconnects silently — something printed to stdout. Check src/**/*.ts — all logs must use utils/logger.ts (stderr). This is the single biggest MCP footgun.

Development

pnpm run dev         # tsx watch
pnpm run typecheck   # tsc --noEmit
pnpm run build       # compile to build/
pnpm run inspect     # launch MCP Inspector

License

MIT

Available Tools

7 tools
continue_edit_sessionContinue Edit SessionA

Apply another edit turn to an existing session. The previous turn's output image is used as the input. Use short, focused prompts like "make the sky more orange" or "add a small boat on the horizon"; include "keep everything else the same" to limit drift. Returns the new image and the updated session.

ParametersJSON Schema
NameRequiredDescriptionDefault
sizeNoOutput dimensions. "auto" (default), one of the presets "1024x1024", "1536x1024", "1024x1536", or a custom "WxH" where both edges are multiples of 16, max edge ≤ 3840px, aspect ratio within 1:3–3:1, and total pixels 655,360–8,294,400. Outputs above 2K are beta.auto
userNoOptional end-user identifier forwarded to OpenAI for abuse monitoring. Pass a stable hashed user ID, not PII.
modelNoModel to use. One of "gpt-image-2", "gpt-image-2.5-flare", "gpt-image-2.5-sunburst"; defaults to "gpt-image-2". The 2.5 variants accept the same parameters. Cost/token estimates assume gpt-image-2 pricing.
promptYesImage description. gpt-image-2 handles very detailed prompts; use ALL CAPS or quote literal text you want rendered verbatim.
qualityNoEdit quality — same levels as generate.auto
backgroundNoBackground behavior. "opaque" forces a filled background; "auto" lets the model pick. gpt-image-2 does NOT support transparent backgrounds — use a different model for that.auto
session_idYesThe session id returned by start_edit_session.
output_formatNoFile format. "png" (default, lossless), "jpeg" (smaller, lossy), "webp" (best compression). When omitted on continue_edit_session, the session's current format is kept.
filename_prefixNoShort label appended to the generated filename so you can find it later (e.g. "hero-banner"). Letters/digits/hyphens only; auto-sanitized.
output_compressionNoCompression level 0–100 for jpeg/webp outputs. Ignored for png. Defaults to 100 (minimal compression).

Output Schema

ParametersJSON Schema
NameRequiredDescription
turnYes
modelYes
notesNoCaveats about how the request was served.
routeNoWhich API route served the request (edit tools only): "direct" = /v1/images/edits, "responses" = Responses-API fallback (one image per call, undercounted cost).
usageYes
imagesYes
promptYes
appliedYes
requestedYes
session_idYes
cost_usd_estimatedYes

TDQS

A4.5/5.0
Behavior4/5

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

With annotations only providing readOnlyHint=false, idempotentHint=false, and openWorldHint=true, the description adds valuable behavioral context: the chaining behavior ('previous turn's output image is used as the input') and the drift-reduction effect of 'keep everything else the same'. It also states what is returned. No contradiction with the annotations was found.

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?

Three sentences, no filler, and the core purpose is front-loaded. The prompt guidance and return-value note are both useful and compact. Every sentence earns its place.

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?

The tool is complex (10 parameters, output schema, sibling session tools), but the description covers purpose, chaining behavior, prompt strategy, and return value. The input schema documents all parameters, the output schema covers results, and annotations cover safety traits. No critical gap remains for an agent to call this correctly.

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 the baseline is 3, but the description adds meaningful guidance beyond the schema for the prompt parameter: use short, focused iterative prompts and optionally include 'keep everything else the same' to limit drift. This is practical parameter-level advice that the schema's generic prompt text does not provide.

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 ('Apply another edit turn to an existing session') and a clear resource ('session'), while also noting that the previous turn's output becomes the next input. The phrase 'another edit turn' and 'existing session' distinguishes it from start_edit_session and edit_image without needing to reference them explicitly.

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 conveys clear context: use this tool for subsequent turns of an existing edit session, after start_edit_session has created it. It also gives actionable prompt-engineering guidance ('short, focused prompts', 'keep everything else the same') to reduce drift. It does not explicitly name sibling tools or state when not to use it, so it falls just short of a 5.

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

edit_imageEdit ImageA

Edit or compose images with OpenAI's gpt-image-2 model family (models: "gpt-image-2" (default), "gpt-image-2.5-flare", "gpt-image-2.5-sunburst"). Give 1–8 input images plus a text prompt; optionally include a PNG mask whose transparent regions mark what to change (mask applies to the first image). Great for: swap backgrounds, retouch products, combine multiple reference images into one composition, maintain a character across scenes. These models always process inputs at high fidelity (no input_fidelity knob needed). The edited image is saved to disk and returned inline. Calls that exceed ~20s (slow proxy routes, large inputs) automatically move to a background job: the first response then carries a job_id — poll get_image_job until it reports state "completed".

ParametersJSON Schema
NameRequiredDescriptionDefault
nNoHow many images to generate (1–10). Each counts toward rate limits and cost.
maskNoOptional PNG mask — fully transparent pixels mark the editable region. Must match the first input image's dimensions and be <4MB. Accepts the same source types as `images`.
sizeNoOutput dimensions. "auto" (default), one of the presets "1024x1024", "1536x1024", "1024x1536", or a custom "WxH" where both edges are multiples of 16, max edge ≤ 3840px, aspect ratio within 1:3–3:1, and total pixels 655,360–8,294,400. Outputs above 2K are beta.auto
userNoOptional end-user identifier forwarded to OpenAI for abuse monitoring. Pass a stable hashed user ID, not PII.
modelNoModel to use. One of "gpt-image-2", "gpt-image-2.5-flare", "gpt-image-2.5-sunburst"; defaults to "gpt-image-2". The 2.5 variants accept the same parameters. Cost/token estimates assume gpt-image-2 pricing.
imagesYesInput images. Each entry can be: an absolute file path, a relative path (resolved from CWD), a file:// URL, an http(s):// URL, or a data:image/...;base64,... URL. PNG/WEBP/JPG, up to 50MB each.
promptYesImage description. gpt-image-2 handles very detailed prompts; use ALL CAPS or quote literal text you want rendered verbatim.
qualityNoEdit quality — same levels as generate.auto
backgroundNoBackground behavior. "opaque" forces a filled background; "auto" lets the model pick. gpt-image-2 does NOT support transparent backgrounds — use a different model for that.auto
output_dirNoAbsolute or relative directory where generated images should be written. Defaults to $GPT_IMAGE_2_OUTPUT_DIR or a per-project subfolder under the OS config dir. The directory is created if missing.
output_formatNoFile format. "png" (default, lossless), "jpeg" (smaller, lossy), "webp" (best compression). When omitted on continue_edit_session, the session's current format is kept.
filename_prefixNoShort label appended to the generated filename so you can find it later (e.g. "hero-banner"). Letters/digits/hyphens only; auto-sanitized.
output_compressionNoCompression level 0–100 for jpeg/webp outputs. Ignored for png. Defaults to 100 (minimal compression).

Output Schema

ParametersJSON Schema
NameRequiredDescription
toolNo
modelNo
notesNo
routeNo
stateNo
usageNo
imagesNo
job_idNoPresent on background hand-off — pass to get_image_job.
promptNo
appliedNo
poll_hintNo
requestedNo
started_atNo
async_after_msNo
prompt_previewNo
cost_usd_estimatedNo

TDQS

A4.3/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false, destructiveHint=false, and idempotentHint=false, which already signal a mutating, non-idempotent operation. The description adds valuable behavior beyond these: background job auto-migration for slow calls, inline return plus file saving, high-fidelity processing with no input_fidelity option, and lack of transparent background support. This contextualizes side effects (file writes) and asynchronous behavior, though it does not discuss potential file overwrites or concurrency implications.

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?

The description is moderately long but efficiently packed. It front-loads purpose and use cases, proceeds to key technical behaviors (mask, fidelity), and ends with the background-job fallback. Every sentence carries operational or decision-relevant information; there is no filler. A tight, organized structure that earns its length.

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 tool with 13 parameters, 2 required, and an output schema, the description covers the essential operational aspects: input types and limits, mask semantics, background constraints, model variants, output handling, and the async job pattern. It does not delve into session integration (e.g., how edit_image relates to continue_edit_session) but that is arguably beyond its direct invocation scope. Given the richness of schema and annotations, the description is adequately complete 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 every parameter is already described. The description adds meaning beyond the schema: it clarifies that the mask applies to the first input image, explains that models always process at high fidelity (explaining absent input_fidelity), explicitly ties 'n' to rate limits/cost (already hinted in schema), and notes transparency limitations tied to the background parameter. This extra context lifts the value beyond the schema baseline of 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?

States a specific verb ('Edit or compose') and a clear resource (images with gpt-image-2 family), lists concrete use cases (swap backgrounds, retouch products, combine reference images), and names at least one constraint (mask applies to first image). It clearly distinguishes from the sibling generate_image by focusing on editing/composition, and the mention of model family and background behavior signals its scope.

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?

Provides explicit use-case guidance ('Great for: swap backgrounds, retouch products...') and notes a limitation ('use a different model for transparent backgrounds'). However, it does not explicitly contrast with generate_image or the session-based siblings (start_edit_session, etc.), nor does it state when NOT to use it beyond the transparency note. Clear context but lacks a direct alternative-routing statement.

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

end_edit_sessionEnd Edit SessionA
DestructiveIdempotent

Free an iterative-edit session. Safe to skip — sessions are in-memory only and are discarded on server restart — but calling this frees memory sooner and keeps list_edit_sessions tidy.

ParametersJSON Schema
NameRequiredDescriptionDefault
session_idYesThe session id to end.

Output Schema

ParametersJSON Schema
NameRequiredDescription
endedYes
session_idYes

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and idempotentHint=true. The description adds valuable context: sessions are in-memory only, discarded on server restart, and calling the tool frees memory sooner. No contradictions found.

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?

Three sentences, all essential. Front-loaded with the main action, then adds usage context and benefits. No filler or redundancy.

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?

Given the simplicity (1 param, high schema coverage, output schema exists), the description covers purpose, usage, and side effects. Could mention what happens if session_id is invalid, but the idempotentHint implies safe handling.

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 coverage is 100%. The parameter 'session_id' is well-documented in the schema with minLength and description. The tool description does not add further parameter details, which is acceptable given the schema coverage.

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?

Clearly states the tool ends an iterative-edit session and distinguishes from siblings like start_edit_session by noting it is optional cleanup. The verb 'Free' and resource 'iterative-edit session' are specific.

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

Usage Guidelines5/5

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

Explicitly states when to use (to free memory sooner, keep list tidy) and when not to use (safe to skip because sessions are discarded on restart). Provides alternative: not calling the tool.

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

generate_imageGenerate ImageA

Generate an image from a text prompt using OpenAI's gpt-image-2 model family (models: "gpt-image-2" (default), "gpt-image-2.5-flare", "gpt-image-2.5-sunburst"). The image is written to disk and also returned inline so you can see it. These models handle photoreal, illustrations, infographics, multilingual text (incl. CJK), and complex structured visuals. They do NOT support transparent backgrounds. Sizes accept presets or any custom "WxH" where edges are multiples of 16, max edge ≤ 3840px, aspect ratio within 1:3–3:1, and total pixels 655,360–8,294,400. Outputs above 2K are beta. Calls that exceed ~20s (slow proxy routes, large sizes, high quality) automatically move to a background job: the first response then carries a job_id — poll get_image_job until it reports state "completed".

ParametersJSON Schema
NameRequiredDescriptionDefault
nNoHow many images to generate (1–10). Each counts toward rate limits and cost.
sizeNoOutput dimensions. "auto" (default), one of the presets "1024x1024", "1536x1024", "1024x1536", or a custom "WxH" where both edges are multiples of 16, max edge ≤ 3840px, aspect ratio within 1:3–3:1, and total pixels 655,360–8,294,400. Outputs above 2K are beta.auto
userNoOptional end-user identifier forwarded to OpenAI for abuse monitoring. Pass a stable hashed user ID, not PII.
modelNoModel to use. One of "gpt-image-2", "gpt-image-2.5-flare", "gpt-image-2.5-sunburst"; defaults to "gpt-image-2". The 2.5 variants accept the same parameters. Cost/token estimates assume gpt-image-2 pricing.
promptYesImage description. gpt-image-2 handles very detailed prompts; use ALL CAPS or quote literal text you want rendered verbatim.
qualityNoGeneration quality. "low" for fast drafts, "medium" balanced (default when model picks), "high" for dense layouts and text, "auto" lets the model choose.auto
backgroundNoBackground behavior. "opaque" forces a filled background; "auto" lets the model pick. gpt-image-2 does NOT support transparent backgrounds — use a different model for that.auto
moderationNoModeration strictness. "auto" (default) applies standard safety filtering; "low" is less restrictive (still subject to OpenAI policy).auto
output_dirNoAbsolute or relative directory where generated images should be written. Defaults to $GPT_IMAGE_2_OUTPUT_DIR or a per-project subfolder under the OS config dir. The directory is created if missing.
output_formatNoFile format. "png" (default, lossless), "jpeg" (smaller, lossy), "webp" (best compression). When omitted on continue_edit_session, the session's current format is kept.
filename_prefixNoShort label appended to the generated filename so you can find it later (e.g. "hero-banner"). Letters/digits/hyphens only; auto-sanitized.
output_compressionNoCompression level 0–100 for jpeg/webp outputs. Ignored for png. Defaults to 100 (minimal compression).

Output Schema

ParametersJSON Schema
NameRequiredDescription
toolNo
modelNo
notesNo
routeNo
stateNo
usageNo
imagesNo
job_idNoPresent on background hand-off — pass to get_image_job.
promptNo
appliedNo
poll_hintNo
requestedNo
started_atNo
async_after_msNo
prompt_previewNo
cost_usd_estimatedNo

TDQS

A4.3/5.0
Behavior5/5

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

Goes well beyond the sparse annotations by disclosing that images are written to disk, returned inline, may move to a background job after ~20s with a job_id to poll via get_image_job, and that outputs above 2K are beta. Also notes the transparency limitation. No contradiction with annotations.

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

Conciseness3/5

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

Dense and front-loaded, but visibly redundant with the schema: the model list, size constraints, transparency limitation, and background option all appear in the input schema with nearly identical wording. The valuable additions (inline return, polling workflow, multilingual capabilities, beta caveat) could be retained while trimming duplicated schema text.

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 12-parameter generation tool with a complete input schema and an output schema, this description is operationally complete. It covers artifact handling, background job polling, model limitations, and output constraints, leaving no critical behavior for the agent to infer.

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 baseline is 3. The description mostly restates schema content (model enum, size constraints, background option) without adding new parameter-level meaning. It adds some operational context, such as inline return and background jobs, but not much beyond the structured fields.

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?

States a specific verb and resource ('Generate an image from a text prompt'), names the model family, and describes the concrete output behavior (written to disk and returned inline). This clearly separates it from siblings like edit_image and get_image_job as the generative entry point.

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?

Provides clear context on when generation is suitable: model strengths (photoreal, illustrations, multilingual text), unsupported transparent backgrounds, and background-job fallback behavior. It does not explicitly name alternatives like edit_image for edits, but the generate-vs-edit distinction is strongly implied by the description and title.

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

get_image_jobGet Image JobA
Read-onlyIdempotent

Poll a backgrounded gpt-image-2 job. generate_image and edit_image automatically move work that runs longer than ~20s (slow proxy / large sizes / high quality) into a background job and return a job_id instead of blocking past MCP client timeouts. Call this with that job_id until state becomes "completed" (files are already written to disk and returned inline) or "failed". While still "running", wait a few seconds between polls.

ParametersJSON Schema
NameRequiredDescriptionDefault
job_idYesThe job_id returned by generate_image / edit_image when they moved the work to the background.

Output Schema

ParametersJSON Schema
NameRequiredDescription
toolYes
errorYes
stateYes
imagesNoWritten image files — present once the job completed successfully.
job_idYes
elapsed_msYes
started_atYes
completed_atYes
prompt_previewYes

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already mark this as read-only/idempotent, and the description adds meaningful behavioral detail: the polling lifecycle (running/completed/failed), that completed means files are already written to disk and returned inline, and the ~20s backgrounding threshold. This goes well beyond the annotation hints.

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?

Three sentences, each earning its place: purpose, backgrounding context, and explicit polling instructions. The main action is front-loaded, and there is no redundant filler repeating the title or schema.

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?

The description is complete for an agent invoking this tool: it explains why a job_id exists, how to obtain it, what states to expect, what to do while running, and what completion/failure means. The output schema covers return structure, and annotations cover the safety profile, so nothing essential is missing.

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?

The schema already describes job_id at 100% coverage, so the baseline is 3. The description adds extra meaning by establishing where the job_id comes from (generate_image/edit_image) and how it should be used (poll until a terminal state). It does not add format details, but for a single required string parameter that is sufficient.

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 and resource: 'Poll a backgrounded gpt-image-2 job.' This clearly separates get_image_job from sibling creation/edit tools like generate_image, edit_image, and the edit-session tools, which have different purposes.

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

Usage Guidelines5/5

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

Explicitly explains when this tool becomes relevant: generate_image/edit_image move long-running work (>~20s) into a background job and return a job_id. It then instructs to call this tool with that job_id until completed or failed, and to wait a few seconds between polls. This is actionable and leaves little to inference.

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

list_edit_sessionsList Edit SessionsA
Read-onlyIdempotent

List active iterative-edit sessions (in-memory only, discarded on server restart). Useful to recover a session_id after a client reconnect.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
sessionsYes

TDQS

A4.7/5.0
Behavior5/5

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

Adds critical context beyond annotations: 'in-memory only, discarded on server restart' and 'active' sessions. Annotations already declare read-only, idempotent, non-destructive, but description explains ephemeral nature.

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?

Two sentences, no wasted words. Front-loaded with key purpose and behavior. Every sentence adds value.

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?

Given zero parameters and an output schema, the description fully covers what the agent needs: what the tool returns (list of sessions) and why it exists. No gaps.

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?

No parameters, so schema coverage is 100%. Description adds no parameter info, but none needed. Baseline score of 4 is appropriate.

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?

Description clearly states 'list active iterative-edit sessions', specifying verb, resource, and scope. Distinguishes from sibling tools like start_edit_session or continue_edit_session.

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?

Provides explicit use case: 'recover a session_id after a client reconnect'. While it doesn't explicitly exclude other uses, it gives clear context for when this tool is useful.

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

start_edit_sessionStart Iterative Edit SessionA

Begin a stateful multi-turn edit session. Returns a session_id you then pass to continue_edit_session to iteratively refine the image (each turn uses the previous turn's output as the input). Use end_edit_session when done.

ParametersJSON Schema
NameRequiredDescriptionDefault
maskNoOptional PNG mask — fully transparent pixels mark the editable region. Must match the first input image's dimensions and be <4MB. Accepts the same source types as `images`.
sizeNoOutput dimensions. "auto" (default), one of the presets "1024x1024", "1536x1024", "1024x1536", or a custom "WxH" where both edges are multiples of 16, max edge ≤ 3840px, aspect ratio within 1:3–3:1, and total pixels 655,360–8,294,400. Outputs above 2K are beta.auto
userNoOptional end-user identifier forwarded to OpenAI for abuse monitoring. Pass a stable hashed user ID, not PII.
modelNoModel to use. One of "gpt-image-2", "gpt-image-2.5-flare", "gpt-image-2.5-sunburst"; defaults to "gpt-image-2". The 2.5 variants accept the same parameters. Cost/token estimates assume gpt-image-2 pricing.
imagesYes1–8 input images to seed the session (same source formats as edit_image).
promptYesImage description. gpt-image-2 handles very detailed prompts; use ALL CAPS or quote literal text you want rendered verbatim.
qualityNoEdit quality — same levels as generate.auto
backgroundNoBackground behavior. "opaque" forces a filled background; "auto" lets the model pick. gpt-image-2 does NOT support transparent backgrounds — use a different model for that.auto
output_dirNoAbsolute or relative directory where generated images should be written. Defaults to $GPT_IMAGE_2_OUTPUT_DIR or a per-project subfolder under the OS config dir. The directory is created if missing.
output_formatNoFile format. "png" (default, lossless), "jpeg" (smaller, lossy), "webp" (best compression). When omitted on continue_edit_session, the session's current format is kept.
filename_prefixNoShort label appended to the generated filename so you can find it later (e.g. "hero-banner"). Letters/digits/hyphens only; auto-sanitized.
output_compressionNoCompression level 0–100 for jpeg/webp outputs. Ignored for png. Defaults to 100 (minimal compression).

Output Schema

ParametersJSON Schema
NameRequiredDescription
turnYes
modelYes
notesNoCaveats about how the request was served.
routeNoWhich API route served the request (edit tools only): "direct" = /v1/images/edits, "responses" = Responses-API fallback (one image per call, undercounted cost).
usageYes
imagesYes
promptYes
appliedYes
requestedYes
session_idYes
cost_usd_estimatedYes

TDQS

A4.3/5.0
Behavior4/5

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

Annotations only say the tool is non-read-only, non-idempotent, and non-destructive. The description adds meaningful behavior beyond that: the session is stateful, it returns a session_id, each turn uses the previous turn's output as input, and the session must be explicitly ended. This gives the agent a usable mental model of an accumulating session without contradicting any annotation.

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?

Three tight sentences: the action, the continuation protocol, and the termination protocol. The most important fact (stateful multi-turn session) is front-loaded, and every sentence contributes distinct information with no filler or repetition of schema details.

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?

Given the rich input schema, the presence of an output schema, and the sibling set, the description covers everything an agent needs to correctly initiate a session: what the tool does, how to continue it, and how to end it. The output schema presumably documents the returned session_id, so the description need not repeat return details.

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 structured schema already documents all 12 parameters with detailed meanings, defaults, and constraints. The description itself adds no parameter-level semantics beyond mentioning session_id and continuation flow. Per the baseline rule for high coverage, a 3 is appropriate.

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 uses a specific verb-resource pair ('Begin a stateful multi-turn edit session') and immediately differentiates itself from siblings by explaining the returned session_id is passed to continue_edit_session for iterative refinement. It also plants the session lifecycle in the reader's mind by naming end_edit_session, so an agent can distinguish this from one-shot edit_image.

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 clearly conveys when this tool is appropriate: when the agent needs a stateful, multi-turn refinement loop where each turn consumes the previous output. It also explains the follow-up flow (continue_edit_session) and termination flow (end_edit_session). It stops short of explicitly saying 'use edit_image for single-shot edits' or listing exclusions, 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.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 7 tool updatesv0.3.0
    • First observedcontinue_edit_session
    • First observededit_image
    • First observedend_edit_session
    • First observedgenerate_image
    • First observedget_image_job
    • First observedlist_edit_sessions
    • First observedstart_edit_session

TDQS

A4.6/5.0

Scored across 7 tools

Disambiguation5/5

Each tool has a unique role: text-to-image generation, one-shot image editing, async job polling, and the session lifecycle (start/continue/end/list). The only adjacent pair is edit_image vs continue_edit_session, but the stateful vs one-shot distinction is clearly explained.

Naming Consistency5/5

All tools follow a consistent verb_noun snake_case pattern such as generate_image, edit_image, get_image_job, start_edit_session, and list_edit_sessions. There are no mixed conventions or vague verbs.

Tool Count5/5

Seven tools is well-scoped for an image generation and editing server. Each tool addresses a distinct need—generation, editing, async polling, and session management—without redundancy.

Completeness5/5

The tool surface covers the full workflow: generate images, edit/compose them, poll background jobs, and manage iterative multi-turn sessions. There are no critical gaps such as missing session termination or job status retrieval.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers