Edit a photo from an AI agent: generate_image with input_references

The hosted MCP generate_image tool takes the same body as POST /v1/images, including input_references. Call tools_schema first, pass an idempotency_key.

4 min readSume
All posts

Image-editing launches assume a person at a canvas. An agent has no canvas; it has tools. The Sume hosted MCP exposes image editing as generate_image, and the MCP tools and gates page lists it among the paid generation tools that need an idempotency_key.

What the tool takes

The Image API docs say the MCP payload schema is the same as the REST body, and a drift test keeps the two from diverging. payload.model is optional on MCP and defaults to sume/auto; REST still requires it. Reference images go in input_references as public HTTPS URLs. Before submit, generate_image passes through /v1/generation/admission-preview, so a cost estimate comes first.

generate_image over MCP versus REST, from Sume docs, read 2026-10-04
ItemMCP generate_imagePOST /v1/images
Body fieldsSame payload schemaSame schema
modelOptional, defaults to sume/autoRequired
Paid-call guardidempotency_key requiredCheck endpoint pricing first
Cost estimateadmission-preview before submitRead endpoint pricing

A payload an agent can send

Ask the agent to call tools_schema with name: "generate_image" first, as the tools page advises, and then send a body like this one. Naming the family (here Nano Banana 2) pins the edit to one model; leaving it out lets Auto choose.

{
  "idempotency_key": "edit-sku-1042-v1",
  "payload": {
    "model": "google/nano-banana-2",
    "prompt": "Change the shirt to navy. Keep face, pose and background identical.",
    "input_references": [
      {"type": "image_url", "image_url": {"url": "https://example.com/sku-1042.png"}}
    ],
    "aspect_ratio": "auto"
  }
}

Keep the agent honest

The docs' upload flow for private files is create upload URL, PUT the bytes, then complete; for generation requests they prefer public HTTPS media URLs.

  • Use one idempotency key per intended edit, and reuse it on a retry of that same edit.
  • Only hand the agent public HTTPS image URLs; hosted MCP cannot read files from your laptop.
  • Tell it which model to pin when you need repeatable edits.

Sources

Related posts

More in Agents

All Agents posts

Written by Sume