Skip to main content
Glama

Generate or edit an image

generate_image

Generate one or more images from a prompt with topx-image, or with topx-image-fast when the call names it for a faster image, optionally following reference images or editing an image (pass images, and mask to change only part of the first image). Billed at the model's per-image price plus a $0.01 call fee; input images are billed as image input tokens. Returns the images inline and as temporary signed links valid for up to one hour; cache capacity may expire them earlier.

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

Input Schema

NameRequiredDescriptionDefault
nNoNumber of images.
maskNoOptional mask for the first image, as a data URL or https link: a PNG of the same width and height whose fully transparent pixels mark the area to change. The model treats it as a guide, so the edit may reach slightly past it.
sizeNoWIDTHxHEIGHT, for example 1024x1024, 1536x1024, 1024x1536 or 2048x2048.1024x1024
modelNoThe topx- ID of the image model: topx-image, or topx-image-fast for a faster image.
imagesNoOptional reference images, or the image to edit: up to 16 PNG, JPEG or WebP images as data URLs (data:image/png;base64,...) or https links, including the links an earlier generate_image call returned. Say in the prompt how to use each, by its position: for example "Put the chair from image 2 into the room in image 1, keep the lighting of image 1". The first image is the one an edit changes and the one mask applies to. Billed as input image tokens on top of the output images.
promptYesWhat to draw, or what to change in the images. Name a style by its movement and what it looks like (Post-Impressionist, swirling impasto, bold outlines) rather than by an artist or named artworks, and write it in one language: the image model's safety filter refuses some prompts that combine those, and refuses them again unchanged.
qualityNoOptional rendering quality.

Output Schema

NameRequiredDescriptionDefault
nNo
sizeNo
urlsNoTemporary signed links, valid for up to one hour; capacity eviction may expire them earlier.
errorNoPresent on a failed call: category (client, wallet, topxai, upstream, budget), message, charged, charged_usd.
modelNo
imagesNoImages returned inline as image content blocks.
maskedNoWhether a mask limited the edit to part of the first image.
chargedNoWhether the wallet was debited for this call.
request_idNoThe relay request id; the same id appears in the usage log.
charged_usdNoThe recorded wallet debit in USD, model price and call fee included.
inline_urlsNoLinks already represented by inline image content; avoid duplicate previews.
call_fee_usdNo
input_imagesNoImages the call sent as references or to edit.
generated_imagesNoImages returned by the generation, including files linked instead of embedded.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / model / description
      Previous value: -"Image model."New value: +"The topx- ID of the image model: topx-image, or topx-image-fast for a faster image."
  2. Changed1 schema field changed
    • changedInput schema / properties / prompt / description
      Previous value: -"What to draw, or what to change in the images."New value: +"What to draw, or what to change in the images. Name a style by its movement and what it looks like (Post-Impressionist, swirling impasto, bold outlines) rather than by an artist or named artworks, and write it in one language: the image model's safety filter refuses some prompts that combine those, and refuses them again unchanged."
  3. Changed5 schema fields changed
    • addedInput schema / properties / images
      Added value: +{
      +  "description": "Optional reference images, or the image to edit: up to 16 PNG, JPEG or WebP images as data URLs (data:image/png;base64,...) or https links, including the links an earlier generate_image call returned. Say in the prompt how to use each, by its position: for example \"Put the chair from image 2 into the room in image 1, keep the lighting of image 1\". The first image is the one an edit changes and the one mask applies to. Billed as input image tokens on top of the output images.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "maxItems": 16,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • addedInput schema / properties / mask
      Added value: +{
      +  "description": "Optional mask for the first image, as a data URL or https link: a PNG of the same width and height whose fully transparent pixels mark the area to change. The model treats it as a guide, so the edit may reach slightly past it.",
      +  "type": "string"
      +}
    • changedInput schema / properties / prompt / description
      Previous value: -"What to draw."New value: +"What to draw, or what to change in the images."
    • addedOutput schema / properties / input_images
      Added value: +{
      +  "description": "Images the call sent as references or to edit.",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / masked
      Added value: +{
      +  "description": "Whether a mask limited the edit to part of the first image.",
      +  "type": "boolean"
      +}
  4. First observed

TDQS

A4.4/5.0
Behavior5/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 it well: it discloses the billing model (per-image price plus a $0.01 call fee, input images billed as image tokens) and the return behavior (inline images plus signed links valid up to one hour, with cache eviction possibly earlier). It also warns that the mask is only a guide and edits may reach past it, which is behavior not encoded anywhere in the schema.

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?

Two sentences, front-loaded with the core action, and every clause carries information. The second sentence is dense — it bundles model choice, billing, and link expiry — but nothing is clearly redundant.

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 tool with an output schema, the description goes beyond what is required by explaining cost and link lifetime. Combined with a fully documented seven-parameter schema, an agent has everything needed to call it correctly and anticipate the response.

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% and the parameter descriptions are already detailed, so the baseline is 3. The description adds modest value by tying model selection to the topx-image-fast name and reinforcing the images/mask relationship, but most parameter meaning is already in 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?

The description opens with a specific verb and resource — 'Generate one or more images from a prompt' — and immediately extends it to the edit mode by naming the images and mask inputs. An agent can tell the generate path from the edit path without opening the schema.

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?

It states the condition for choosing topx-image-fast ('when the call names it') and explains when to pass images and mask ('to change only part of the first image'). There is no explicit when-not-to-use guidance, but with no sibling tools the only meaningful alternative is the model choice, which is covered.

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