Skip to main content
Glama

Edit an existing image with AI

edit_image

Edit an image you already have: change the background, add or remove an object, restyle it, make a variation. Pass the image URL in baseImageUrl and what to change in prompt. Returns a durable public URL ready to pass to create_post. Synchronous. Costs 20 AI credits per image (40 when reference images are attached), the same as generate_image. For a new image from text, or an edit that also needs an aspect ratio, product photos or characters, use generate_image. Nothing is charged if it fails. SPENDS AI CREDITS ONLY WITH confirm: true. Call it first without confirm: nothing runs and nothing is charged, you get the quote (what it will do and the credits). Tell the user, in your own words, exactly that — including the options you chose, so they can change them — and wait for a clear yes before calling again with the same arguments and confirm: true. One yes covers the plan they approved (e.g. every line of an approved voice-over with the chosen voice); anything new or different needs a new yes.

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

Input Schema

NameRequiredDescriptionDefault
promptYesWhat to change, in detail. Describe the result you want, not the steps: "same product on a marble surface, soft daylight from the left".
confirmNotrue ONLY after the user said yes to the quote (what it does and the credits). Without it nothing runs and nothing is charged.
workspaceIdNoWorkspace to work on (an id from list_workspaces). Not needed when this connection is tied to one workspace, or when you pass an account: the account's workspace is used.
baseImageUrlYesPublic https URL of the image to edit. Use list_library_media or list_account_media to find one.
reservationIdNoOptional. A credit reservation (from an approved production) to pay this image from, instead of the monthly pool.
idempotencyKeyNoOptional. A unique id for this action (16-128 chars: letters, digits, _ : . -). If you are unsure whether a call went through (timeout, network error), repeat it with the SAME idempotencyKey and the same arguments: you get the original result and nothing is done twice.

Output Schema

NameRequiredDescriptionDefault
urlNoDurable public URL of the edited image.
quotaUsedNo
quotaLimitNo
confirmTokenNo
estimatedCreditsNo
needsConfirmationNotrue = this is only the quote: nothing was done or charged.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedOutput schema / properties / confirmToken
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / estimatedCredits
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / needsConfirmation
      Added value: +{
      +  "description": "true = this is only the quote: nothing was done or charged.",
      +  "type": "boolean"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "url"
      -]
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only supply the safety profile (readOnlyHint false, destructiveHint false, openWorldHint true, idempotentHint false); the description goes well beyond by disclosing per-call pricing (20 credits, 40 with reference images) and the no-charge-on-failure guarantee. It also documents the synchronous nature, the durable return URL, and the full quote-then-confirm spend gate, which is exactly the behavioral context an agent needs before a paid mutation.

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-loads purpose and the core two-parameter instruction before pricing and the confirm ritual, so the most important content is first. It is dense rather than padded, but the confirm paragraph is long and partially duplicates the confirm parameter's own schema description, keeping it out of the top band.

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 paid, non-idempotent, open-world mutation with six parameters, the description covers cost, failure cost, spend gating, output form (durable public URL ready for create_post) and the alternative tool. With an output schema present it correctly avoids re-explaining return structure while still naming the URL's usability.

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 earns an extra point by tying the two required parameters to the workflow and by implying via the generate_image redirect that aspect ratio, product photos and characters are not expressible here. The confirm protocol is restated with meaning the terse schema note cannot carry (one approval covers the plan; anything different needs a new yes).

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 ("Edit an image you already have") and immediately enumerates the concrete edit classes it supports (background, add/remove object, restyle, variation). It explicitly names the sibling it is not — generate_image — and gives the condition that selects that sibling, so an agent can differentiate without opening either schema.

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?

States both when to use this tool and when not to: "For a new image from text, or an edit that also needs an aspect ratio, product photos or characters, use generate_image." It also prescribes the two-phase call pattern (call first without confirm, then again with confirm: true) and scopes what one yes covers, which is genuine routing guidance rather than generic context.

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.

Resources