Skip to main content
Glama

edit_image

Repaint only a masked region of an existing local image while preserving all outside pixels; supply a mask image or region coordinates.

Instructions

EDIT an existing local image: repaint only the masked area (inpainting) while the rest stays pixel-identical -- the tool re-composes the result on the CPU, so outside-mask pixels cannot drift. Give either mask_image or regions. Models are chosen by priority (qwen-image-edit > flux2-klein > qwen-image); the loaded model wins when it can region-edit. Returns absolute PNG paths for the agent to inspect.

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": {
      "init_image": "<init_image>",
      "prompt": "<prompt>"
    },
    "name": "edit_image"
  }
}

Input Schema

NameRequiredDescriptionDefault
seedNo-1 for random.
modelNoModel to use. Omit to let the tool pick by priority (qwen-image-edit > flux2-klein > qwen-image).
stepsNoSampling steps. Defaults to the engine's own.
promptYesThe change to make, described in English. Say WHAT should appear in the masked area, not what to 'edit'.
verifyNoagent = the calling agent must inspect the returned image.
channelNoEngine endpoint. auto tries /sdcpp/v1/img_gen first, then /sdapi/v1/img2img.
dry_runNoBuild the mask and payload, call nothing. Use it to check coordinates cheaply.
regionsNoAreas to repaint, drawn on the CPU into a greyscale PNG mask. White = repaint, black = keep. Use this when you have no mask file. Example: {"unit":"norm","regions":[{"type":"rect","x":[0.1,0.4,0.6,0.9]}]}.
samplerNoSampler name, e.g. euler.
strengthNoDenoising strength 0..1 (default 0.75). Low keeps the original look, high follows the prompt harder.
cfg_scaleNoCFG / guidance scale.
mask_blurNoMask feather in pixels (engine side).
timeout_sNoJob timeout in seconds (default 900).
init_imageYesAbsolute path of the image to modify (PNG or JPEG).
mask_imageNoAbsolute path of a mask PNG (white = repaint). Rescaled to the image size when needed. Use the bundled annotator to draw one.
output_dirNoAbsolute output directory.
filename_prefixNoFilename prefix.
inpaint_paddingNoExtra context pixels around the mask.
negative_promptNoWhat to avoid inside the mask.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.0.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the CPU re-composition guarantee (outside-mask pixels cannot drift), the model-selection/fallback rule, and that absolute PNG paths are returned. It omits failure modes and what happens when the requested model cannot region-edit beyond the one-line priority note.

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?

Three front-loaded sentences with no filler; the core behavior and the guarantee come first, with input-choice and model-selection details after. Slightly dense with parenthetical asides but every sentence carries information.

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 19-parameter, nested-schema tool with no output schema, the description covers the essentials: what it does, how to specify the mask, how models are chosen, and what is returned. Deeper parameter-level guidance is delegated to a very complete schema.

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 adds value by explaining the mask_image-versus-regions tradeoff and how model omission triggers priority selection. The remaining 19 parameters (strength, sampler, channel, etc.) are left entirely to the schema.

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 ("EDIT an existing local image") plus the precise scope: repaint only the masked area via inpainting. It also distinguishes itself from image-generation siblings by requiring an existing init image and a mask.

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?

Explicitly resolves the key selection decision between the two masking inputs ("Give either mask_image or regions") and explains the model-priority fallback. It does not name sibling alternatives such as redraw_image or generate_image, so an agent must infer when to pick this over those.

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