Edit image
edit_imageEdit or combine images from disk using a text prompt, creating a new output file without altering the source files.
Instructions
Edit or combine existing image file(s) using a text instruction: modify elements, restyle, add or remove content, or merge references. Reads the source image(s) from disk, saves the result as a NEW file (never overwrites sources), and returns the absolute saved path(s).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of images, 1-4 (default 1). Gemini generates sequentially, so n>1 is slower there. | |
| model | No | Override the model. Gemini: gemini-3.1-flash-image (default), gemini-3.1-flash-lite-image, gemini-3-pro-image, gemini-2.5-flash-image. OpenAI: gpt-image-2 (default, best quality), gpt-image-1.5, gpt-image-1, gpt-image-1-mini. IMPORTANT: gpt-image-2 cannot do transparent backgrounds; pass gpt-image-1.5 when background transparent is needed. | |
| prompt | Yes | The edit instruction, e.g. "make the background transparent" or "restyle as a flat vector logo". | |
| quality | No | OpenAI only, ignored by Gemini. Use low for cheap drafts. | |
| provider | No | Override the default provider. Call list_capabilities to see what is configured. | |
| background | No | OpenAI only, ignored by Gemini. transparent yields alpha PNG/WebP, ideal for logos and icons. Requires gpt-image-1.5 or older: gpt-image-2 does not support it, so transparent calls on gpt-image-2 auto-switch to gpt-image-1.5 (noted in the result). Prefer passing model gpt-image-1.5 explicitly when you need transparency. | |
| image_size | No | Gemini 3.x models only (ignored by OpenAI; gemini-2.5-flash-image is fixed at 1024px). Default 1K. | |
| output_path | No | Absolute path strongly recommended. Either a full file path (.png/.jpg/.webp) or a directory (a slugified filename is derived from the prompt). If omitted: $IMAGE_GEN_MCP_OUTPUT_DIR, then $CLAUDE_PROJECT_DIR, then the server cwd. The server may be restricted to specific directories; call list_capabilities to see allowedDirs. | |
| aspect_ratio | No | Gemini and OpenAI gpt-image-2 honor the ratio exactly. Older OpenAI models approximate: landscape -> 1536x1024, portrait -> 1024x1536, 1:1 -> 1024x1024. | |
| return_image | No | Default false. When true, also returns the FIRST image as an inline MCP image block so you can see it without a Read. Large images can exceed the MCP output token limit; for 2K/4K prefer Read on the saved path. | |
| source_paths | Yes | Absolute paths to existing input images (.png/.jpg/.jpeg/.webp). The first is the primary edit target; extras act as references. OpenAI accepts up to 16; Gemini works best with 1-3. | |
| input_fidelity | No | OpenAI only. high preserves faces, logos, and fine details from the input more faithfully. Ignored on gpt-image-2, which always processes inputs at high fidelity. |