Skip to main content
Glama

Edit image

editImage

Modify an existing image according to text instructions: supply a source image (URL or base64) and a prompt describing the changes (e.g. "add clouds", "warmer color scheme"), with an optional reference_image for extra style or content guidance. To change only one area, pass a mask (white = change, black = keep, the same size as the image): mask_mode "replace" (default) redraws that area from the prompt, "erase" removes what is there. Without a mask the whole image is re-rendered. Never ask for a transparent background in the prompt: it often comes back as a grey-and-white checkerboard painted into the pixels, which removeBackground cannot remove. A sprite keeps its transparency without being asked (see image_type). The job result is an array of image results, each with a url; request n (1-4) to control the number of edited variations. Provided images are uploaded and validated, and any image larger than 15MB is rejected with HTTP 400. Credits are held when the job is accepted and refunded if it fails or is cancelled; the charge scales with the number of images produced. Use editImage to transform a specific existing image; use createImage to generate from text alone, generateWithStyle to borrow a reference's art style, and removeBackground for the dedicated background-removal case. Pass an optional request_id to tag the results so you can retrieve them later via listGenerations (type image). Async generation job: returns {id, status} - poll getApiJob (job and credit contract: see the server instructions).

Credits: This endpoint consumes 0.5 credits per result; 1 credit per result with a mask.

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": {
      "requestBody": "<requestBody>"
    },
    "name": "editImage"
  }
}

Input Schema

NameRequiredDescriptionDefault
requestBodyYesPayload for editing an existing image based on text instructions

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / requestBody / properties / save_normals
      Added value: +{
      +  "description": "Also make a normal map of each image, for 2.5D lighting, returned as normal_map_url. It is a lossless WebP of the same size and alpha as the image, in the OpenGL convention (red = right, green = up, blue = towards the viewer; Unity and Godot read it as is, Unreal expects green flipped). Pixel art gets one normal per art pixel. Free; when a map could not be made, its normal_map_url is absent. Default: false.",
      +  "example": false,
      +  "type": "boolean"
      +}
  2. Changed1 schema field changed
    • changedInput schema / properties / requestBody / properties / image_type / enum
      Previous value: -[
      -  "generic",
      -  "screenshot",
      -  "art",
      -  "asset",
      -  "sprite",
      -  "sprite-vfx",
      -  "sprite-tiling-horizontal",
      -  "sprite-tiling-vertical",
      -  "icon",
      -  "logo",
      -  "ui_asset",
      -  "fixed_background",
      -  "side_scrolling_background",
      -  "vertical_scrolling_background",
      -  "parallax_layer",
      -  "texture",
      -  "tile",
      -  "item-icon",
      -  "portrait",
      -  "card-art",
      -  "splash",
      -  "3d"
      -]New value: +[
      +  "generic",
      +  "screenshot",
      +  "art",
      +  "asset",
      +  "sprite",
      +  "sprite-vfx",
      +  "sprite-tiling-horizontal",
      +  "sprite-tiling-vertical",
      +  "scatter-pattern",
      +  "icon",
      +  "logo",
      +  "ui_asset",
      +  "fixed_background",
      +  "side_scrolling_background",
      +  "vertical_scrolling_background",
      +  "parallax_layer",
      +  "texture",
      +  "tile",
      +  "item-icon",
      +  "portrait",
      +  "card-art",
      +  "splash",
      +  "3d"
      +]
  3. Changed1 schema field changed
    • removedInput schema / properties / requestBody / properties / augment_prompt
      Removed value: -{
      -  "description": "Rewrites your prompt behind the scenes into the form the model works best with. Leave it on (the default). Turning it off does not give you more control - it usually gives worse results. Do not disable it unless you really know what you are doing and have tested your prompts extensively. Default: true.",
      -  "example": true,
      -  "type": "boolean"
      -}
  4. Changed1 schema field changed
    • changedInput schema / properties / requestBody / properties / prompt / description
      Previous value: -"Text description of the changes to make (e.g., \"remove the background\", \"add clouds to the sky\", \"make it darker\", \"change the color scheme to warmer tones\"). Required, except with mask_mode \"erase\". With a mask, describe what should fill the masked area."New value: +"Text description of the changes to make (e.g., \"add clouds to the sky\", \"make it darker\", \"change the color scheme to warmer tones\"). Required, except with mask_mode \"erase\". With a mask, describe what should fill the masked area. Describe only the change, never the background's transparency (\"transparent background\", \"on transparency\", \"transparent padding\"); asking for it often paints a checkerboard into the pixels instead. A sprite keeps its transparent background on its own, and removeBackground is the tool for removing one."
  5. Changed5 schema fields changed
    • addedInput schema / properties / requestBody / properties / mask
      Added value: +{
      +  "description": "Optional URL or base64-encoded PNG that limits the edit to one area of the image. White marks the area to change, black the area to keep. It must be exactly the same width and height as `image`, or the call returns 400. Without a mask the whole image is re-rendered, which can shift colours and details outside the part you meant to change. A masked edit costs more than an unmasked one (see the price).",
      +  "example": "<url> OR data:image/png;base64,...",
      +  "type": "string"
      +}
    • addedInput schema / properties / requestBody / properties / mask_mode
      Added value: +{
      +  "description": "Only with `mask`. \"replace\" (the default) redraws the masked area from `prompt`; \"erase\" removes what is in the masked area and takes no prompt.",
      +  "enum": [
      +    "replace",
      +    "erase"
      +  ],
      +  "example": "replace",
      +  "type": "string"
      +}
    • changedInput schema / properties / requestBody / properties / prompt / description
      Previous value: -"Text description of the changes to make (e.g., \"remove the background\", \"add clouds to the sky\", \"make it darker\", \"change the color scheme to warmer tones\")."New value: +"Text description of the changes to make (e.g., \"remove the background\", \"add clouds to the sky\", \"make it darker\", \"change the color scheme to warmer tones\"). Required, except with mask_mode \"erase\". With a mask, describe what should fill the masked area."
    • changedInput schema / properties / requestBody / properties / reference_image / description
      Previous value: -"Optional URL or base64-encoded reference image for style or content guidance."New value: +"Optional URL or base64-encoded reference image for style or content guidance. Not used with mask_mode \"erase\"."
    • changedInput schema / properties / requestBody / required
      Previous value: -[
      -  "image",
      -  "prompt"
      -]New value: +[
      +  "image"
      +]
  6. Changed1 schema field changed
    • changedInput schema / properties / requestBody / properties / augment_prompt / description
      Previous value: -"Augment the prompt behind the scenes. Disable to have more control. Default: true."New value: +"Rewrites your prompt behind the scenes into the form the model works best with. Leave it on (the default). Turning it off does not give you more control - it usually gives worse results. Do not disable it unless you really know what you are doing and have tested your prompts extensively. Default: true."
  7. Changed1 schema field changed
    • changedInput schema / properties / requestBody / properties / image_type / description
      Previous value: -"What kind of image the source is (e.g. \"sprite\"). Not needed when `image` is the URL of an image you generated on Ludo in the last 30 days, which keeps its own type. Set it when you pass base64 or an external URL, so a sprite is edited as a sprite and keeps its transparent background."New value: +"What kind of image the source is (e.g. \"sprite\"). Not needed when `image` is the URL of an image you generated on Ludo in the last 30 days, which keeps its own type. Set it when the image is an upload or a link from elsewhere, so a sprite is edited as a sprite and keeps its transparent background."
  8. Changed1 schema field changed
    • addedInput schema / properties / requestBody / properties / image_type
      Added value: +{
      +  "description": "What kind of image the source is (e.g. \"sprite\"). Not needed when `image` is the URL of an image you generated on Ludo in the last 30 days, which keeps its own type. Set it when you pass base64 or an external URL, so a sprite is edited as a sprite and keeps its transparent background.",
      +  "enum": [
      +    "generic",
      +    "screenshot",
      +    "art",
      +    "asset",
      +    "sprite",
      +    "sprite-vfx",
      +    "sprite-tiling-horizontal",
      +    "sprite-tiling-vertical",
      +    "icon",
      +    "logo",
      +    "ui_asset",
      +    "fixed_background",
      +    "side_scrolling_background",
      +    "vertical_scrolling_background",
      +    "parallax_layer",
      +    "texture",
      +    "tile",
      +    "item-icon",
      +    "portrait",
      +    "card-art",
      +    "splash",
      +    "3d"
      +  ],
      +  "example": "sprite",
      +  "type": "string"
      +}
  9. Changed1 schema field changed
    • changedInput schema / properties / requestBody / properties / request_id / description
      Previous value: -"Optional client-provided identifier, unique per request. Re-sending the same request_id returns the existing job instead of generating again. Also usable with the results endpoint."New value: +"Optional client-provided identifier, unique per request. Re-sending the same request_id returns the existing job instead of generating again. Also usable as the request_id filter of listGenerations."
  10. Changed4 schema fields changed
    • removedInput schema / properties / requestBody / properties / augment_prompt / default
      Removed value: -true
    • changedInput schema / properties / requestBody / properties / augment_prompt / description
      Previous value: -"Augment the prompt behind the scenes. Disable to have more control."New value: +"Augment the prompt behind the scenes. Disable to have more control. Default: true."
    • removedInput schema / properties / requestBody / properties / n / default
      Removed value: -1
    • changedInput schema / properties / requestBody / properties / n / description
      Previous value: -"Number of edited variations to generate (1-4)."New value: +"Number of edited variations to generate (1-4). Default: 1."
  11. Changed1 schema field changed
    • changedInput schema / properties / requestBody / properties / request_id / description
      Previous value: -"Optional client-provided identifier for this request. Use this to retrieve results later via the results endpoint."New value: +"Optional client-provided identifier, unique per request. Re-sending the same request_id returns the existing job instead of generating again. Also usable with the results endpoint."
  12. Changed1 schema field changed
    • addedInput schema / properties / requestBody / properties / request_id
      Added value: +{
      +  "description": "Optional client-provided identifier for this request. Use this to retrieve results later via the results endpoint.",
      +  "type": "string"
      +}
  13. Added

TDQS

A4.8/5.0
Behavior5/5

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

Goes well past the annotations: 15MB upload rejection with HTTP 400, credits held on accept and refunded on failure, per-result cost scaling (0.5 credits, 1 with mask), async contract returning {id, status} with getApiJob polling, and request_id dedupe behavior. The checkerboard/transparency failure mode is a genuinely useful behavioral warning not derivable from schema or 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?

Front-loaded and logically ordered: core action, mask behavior, pitfall warning, output/async contract, sibling routing, pricing. It is long and the transparency warning is repeated in both the description and the prompt schema field, which is mild redundancy for a tool with this many options.

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?

Covers the full call lifecycle for a complex async, credit-consuming, nested-payload tool: input sources, mask rules, output shape (array of results with url), variation count, polling tool, pricing, and error conditions. No output schema exists, and the description supplies the return contract that would otherwise be 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?

Schema coverage is 100%, so the baseline is 3; the description still adds meaning by explaining mask_mode semantics ('replace' redraws, 'erase' removes and takes no prompt), that reference_image is ignored with erase, and when image_type is unnecessary. Some of this restates schema text, which keeps it from a 5.

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 ('Modify an existing image according to text instructions') and immediately names the input contract (source image + prompt, optional reference_image, mask). It explicitly differentiates itself from createImage, generateWithStyle, and removeBackground, so an agent can pick it without opening 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?

Explicit routing sentence: 'Use editImage to transform a specific existing image; use createImage to generate from text alone, generateWithStyle to borrow a reference's art style, and removeBackground for the dedicated background-removal case.' It also states the mask vs. no-mask condition and when image_type must be set (upload or external link vs. recent Ludo-generated URL).

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.