Skip to main content
Glama

Edit Image

xbrush_image_edit

Edit an image from a URL with text instructions. Supports inpainting (mask-based edits) and outpainting (canvas extension); runs asynchronously, so poll the request_id for results.

Instructions

Edit an image with text instructions. For inpainting use an edit model; for outpainting (extending the canvas) use an outpaint model — there is no separate outpaint tool. Submits async — poll the returned request_id with xbrush_get_request.

Args: model (string, required): Inpaint: qwen-image-edit, nano-banana-edit, seedream-4.5-edit. Outpaint: flux-outpaint, qwen-outpaint. See xbrush_list_models(category='image'). prompt (string, required): Text instruction for the edit. image_url (string, required): URL of the primary source image (also the first reference). image_urls (string[], optional): Additional reference image URLs for multi-reference models (gpt-image-2-edit, nano-banana-edit). Model receives [image_url, ...image_urls]. n (int, optional): Number of results (1-8). Default: 1. mask_url (string, optional): Mask image URL (white=edit, black=preserve). mode (string, optional): Hint 'inpaint'/'outpaint'; the chosen model determines the actual operation. width (int, optional): Output width (256-4096). Megapixel/outpaint models use it directly (outpaint: target canvas width). Resolution-based edit models ignore it UNLESS aspect_ratio:"custom" (see aspect_ratio). height (int, optional): Output height (256-4096). Same rules as width (outpaint: target canvas height). resolution (string, optional): Resolution tier for resolution-based edit models (gpt-image-2-edit, seedream-*-edit, nano-banana-pro/2-edit), e.g. "1K"/"2K"/"4K". aspect_ratio (string, optional): Aspect ratio for resolution-based edit models. gpt-image-2-edit: 1:1, 3:2, 2:3, 4:3, 3:4, 4:5, 16:9, 9:16, 21:9, 1.91:1 (1K/2K); only 16:9/9:16/21:9/1.91:1 at 4K. Special value "custom": gpt-image-2-edit outputs the exact width×height you pass (both required; each a multiple of 16, longest edge ≤3840, total pixels 655,360–8,294,400). quality (string, optional): low/medium/high — gpt-image-2-edit only. seed (int, optional): Random seed.

Note: resolution-based edit models (gpt-image-2-edit, seedream-*-edit, nano-banana-pro/2-edit) ignore width/height — passing them returns an error. Exception: aspect_ratio:"custom" with width+height yields an EXACT pixel size on gpt-image-2-edit. Note: to give multiple reference images (e.g. compose two subjects with gpt-image-2-edit), put the primary in image_url and the rest in image_urls.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nNoNumber of edited images (1-8). Default: 1.
modeNoOptional hint ('inpaint'/'outpaint'). The selected model ultimately determines the operation — pick an outpaint model to outpaint.
seedNoRandom seed for reproducible results.
modelYesEditing model. Inpaint/instruct-edit: qwen-image-edit, nano-banana-edit, seedream-5.0-pro-edit, flux.2-pro-edit. Outpaint: flux-outpaint, qwen-outpaint. Use xbrush_list_models(category='image').
widthNoOutput width in pixels (256-4096) for megapixel-based models; for outpaint models, the target canvas width. Resolution-based edit models normally ignore it — but with aspect_ratio:"custom", gpt-image-2-edit outputs exactly width×height (both required).
heightNoOutput height in pixels (256-4096) for megapixel-based models; for outpaint models, the target canvas height. Resolution-based edit models ignore it unless aspect_ratio:"custom" (see width).
promptYesText instruction describing the desired edits.
qualityNoOutput quality tier. Applies to byResolutionAndQuality models (gpt-image-2-edit); higher = better and more expensive. Server default is high if omitted.
mask_urlNoMask image URL. White areas = edit, black areas = preserve.
image_urlYesURL of the primary source image to edit (also the first reference).
image_urlsNoAdditional reference image URLs for models that compose from multiple references (e.g. gpt-image-2-edit, nano-banana-edit). Appended after image_url, so the model receives [image_url, ...image_urls]. Omit for single-reference edits.
resolutionNoOutput resolution tier for resolution-based edit models (gpt-image-2-edit, seedream-*-edit, nano-banana-pro/2-edit). Examples: "1K", "2K", "4K".
aspect_ratioNoAspect ratio for resolution-based edit models (e.g. "16:9"). gpt-image-2-edit supports 1:1, 3:2, 2:3, 4:3, 3:4, 4:5, 16:9, 9:16, 21:9, 1.91:1 at 1K/2K — at 4K only 16:9, 9:16, 21:9, 1.91:1. Special value "custom" makes gpt-image-2-edit use width×height as the exact output size (both required, each a multiple of 16, longest edge ≤3840, total pixels 655,360–8,294,400). seedream-*-edit / nano-banana-*-edit accept their own sets; an unsupported value is rejected with the list of allowed ratios.
Behavior5/5

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

Beyond the annotations, the description discloses the async submission and polling mechanism: 'Submits async — poll the returned request_id with xbrush_get_request.' It also reveals model-specific behavior such as resolution-based models ignoring width/height and raising errors, the custom aspect_ratio exception, and the exact image_urls ordering passed to the model. 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.

Conciseness4/5

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

The description is front-loaded with the core purpose and uses a clear Args list plus notes. It is long, but the tool has 13 parameters and many conditional behaviors; nearly every sentence carries useful information. Minor redundancy with the input schema prevents a perfect score.

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 complex, 13-parameter tool with no output schema, the description is remarkably complete: it covers async behavior, model categories, parameter semantics, model-specific constraints, reference-image ordering, and return value (request_id). An agent could correctly invoke this tool without additional documentation.

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

Parameters5/5

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

Even though schema coverage is 100%, the description adds substantial meaning: it partitions models into inpaint/outpaint categories, explains that mask white=edit and black=preserve, clarifies when width/height are used or ignored, defines the 'custom' aspect-ratio behavior with exact pixel constraints, and scopes quality to gpt-image-2-edit only. This goes far beyond the schema's property descriptions.

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+resource statement: 'Edit an image with text instructions.' It immediately distinguishes inpainting vs outpainting, and explicitly notes there is no separate outpaint tool, clearly differentiating from image generation, upscaling, and background-removal siblings.

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?

The description gives explicit when-to-use guidance: 'For inpainting use an edit model; for outpainting (extending the canvas) use an outpaint model — there is no separate outpaint tool.' It also directs users to xbrush_list_models(category='image') for model selection and explains multi-reference usage, covering both alternatives and prerequisites.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lweight/xbrush-api-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server