Skip to main content
Glama

Edit image

edit_image

Edit an existing image using a natural-language instruction while preserving its width, height and aspect ratio by default. Never overwrites the input file.

Instructions

Edit an existing image with a natural-language instruction (e.g. 'make the background nighttime, keep the foreground unchanged'). Preserves the input's width, height and aspect ratio by default. The input file is never overwritten.

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

Input Schema

NameRequiredDescriptionDefault
seedNoSeed for reproducible results; omit or -1 for random. Never reuse the seed the source image was generated with: use a different one or omit it
promptYesThe edit instruction, written by you in English and used as is (Kokon does not rewrite it): start with the operation (Change, Replace, Remove, Add, Turn...), say exactly what changes, where, and what it becomes, in 20-60 words; describe only what changes and end with 'Keep everything else in the image unchanged.' For a whole-image style or mood change, end with 'Keep the composition and the subjects unchanged.' instead.
qualityNoAll run Qwen-Image 2.1 Turbo (8 steps): fast = ~1 MP (the default, fastest); balanced = ~1.5K; quality = native 2K (slowest; edits share 2K with their references)
image_pathYesImage to edit (absolute, or relative to the project)
output_pathNoOptional destination (absolute, or relative to the project). Must be inside the project or the app output folder. Existing files are never overwritten; a numbered name is used instead.
include_previewNoAlso return a small JPEG preview in the tool result. Default false: images stay local and are not sent to the model.
preserve_dimensionsNoKeep the input's exact width/height (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.10.2
    • changedInput schema / properties / prompt / description
      Previous value: -"The change to make, e.g. 'make the background nighttime, keep the foreground unchanged'"New value: +"The edit instruction, written by you in English and used as is (Kokon does not rewrite it): start with the operation (Change, Replace, Remove, Add, Turn...), say exactly what changes, where, and what it becomes, in 20-60 words; describe only what changes and end with 'Keep everything else in the image unchanged.' For a whole-image style or mood change, end with 'Keep the composition and the subjects unchanged.' instead."
    • changedInput schema / properties / seed / description
      Previous value: -"Seed for reproducible results; omit or -1 for random"New value: +"Seed for reproducible results; omit or -1 for random. Never reuse the seed the source image was generated with: use a different one or omit it"
  2. First observedv0.9.3

TDQS

A3.8/5.0
Behavior4/5

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

Annotations only declare the generic profile (not read-only, not destructive, non-idempotent). The description adds real behavioral context beyond them: default preservation of width/height/aspect ratio and the guarantee that the input file is never overwritten. It stops short of describing the returned result or how the seed affects reproducibility.

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 short sentences, front-loaded with the core action and an illustrative example, then the two behavioral guarantees. Nothing is redundant or padded.

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 7-parameter, fully documented, non-destructive tool with annotations and no output schema, the description covers purpose and key guarantees adequately. The one gap is what the tool returns (output path vs. preview), which the agent must infer from parameters.

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 schema already explains every parameter including the seed and prompt-writing conventions. The description's mention of preserved dimensions merely restates the preserve_dimensions default and adds no new syntax or semantics, making the baseline 3 correct.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 image') and adds a concrete instruction example, so the agent knows exactly what the tool does. It does not, however, differentiate itself from close siblings like edit_images, inpaint_image or outpaint_image.

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

Usage Guidelines3/5

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

Usage is implied by 'natural-language instruction' on an existing image (versus generate_image), and the 'keep the foreground unchanged' example hints at targeted edits. There is no explicit statement of when to prefer this over edit_images (batch) or inpaint_image (masked edits), so the agent must infer routing from sibling names.

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