Skip to main content
Glama

image.generate

[paid: $0.06/image max] Generate 1-3 images from a text prompt on the first lane that delivers, tried in order: google/nano-banana-2.1 via the Cloudflare AI catalog ($0.06/image), then @cf/black-forest-labs/flux-2-dev via Cloudflare Workers AI, only when the first lane is down ($0.00/image). Each lane settles its own price per delivered image, so an image never costs more than the first lane's price, the credit a call must have available before it runs; price.charged_micro_usd in the result is the actual charge. Nano Banana keeps printed words (signs, labels, posters) legible; for a product photo the owner already has, image.variation with the photo as reference keeps the real product. Each image is stored in this workspace's image library and returned as JSON {images:[{url, asset_key, download_url?, width, height}], price, next} plus a preview; never a provider link. A result with no download_url says why in download_url_unavailable. Refuses: VALIDATION_ERROR on an empty prompt (describe the image), INSUFFICIENT_CREDITS (add credits), SIMPLER_IMAGE_PROMPT_REFUSED names the label (sexual, minor, real_person or other_unsafe): rewrite the prompt without it, for example no real person's name or likeness; SIMPLER_IMAGE_PROMPT_CHECK_UNAVAILABLE (the safety check is down, nothing charged: retry later); SIMPLER_IMAGE_OUTPUT_FLAGGED (the output failed the content check and was refunded: change the prompt); SIMPLER_IMAGE_OUTPUT_SCAN_UNAVAILABLE (outputs cannot be checked right now, nothing charged: retry later). A partial result lists refunded outputs in output.withheld; SIMPLER_IMAGE_RESULT_UNDELIVERED means nothing was charged: retry. For canvas-sized generation inside an edit session use image.generate_for_edit. NEXT: pass images[0].asset_key as image_asset_key to image.variation or image.upscale.

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": "image.generate"
  }
}

Input Schema

NameRequiredDescriptionDefault
countNoNumber of images (1-3, default 1).
widthNoDesired width px (256-2048; sets the aspect ratio: the image comes out at about 2K on the long side at the nearest of 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16).
heightNoDesired height px (256-2048; sets the aspect ratio with width).
promptYesImage description (max 1500 chars).
request_refNoOptional idempotency key (1-64 chars: letters, digits, . _ : -). Retrying with the same request_ref and the same arguments within 24 hours returns the first result at $0 with replayed: true; the same request_ref with different arguments is refused (SIMPLER_IMAGE_REQUEST_REF_CONFLICT), and so is a retry whose first result was deleted since (SIMPLER_IMAGE_REQUEST_REF_RESULT_DELETED): send a new request_ref to run it again.
preview_formatNoPreview block after the JSON, at most 384px on the long edge and never charged: png, jpeg or none. Left out, a PNG result gets a png preview and a JPEG or WebP result a jpeg one. A result with no preview says why in preview_unavailable.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / height / description
      Previous value: -"Desired height px (256-2048; the model outputs 1K-class at the nearest aspect ratio)."New value: +"Desired height px (256-2048; sets the aspect ratio with width)."
    • changedInput schema / properties / width / description
      Previous value: -"Desired width px (256-2048; the model outputs 1K-class at the nearest aspect ratio)."New value: +"Desired width px (256-2048; sets the aspect ratio: the image comes out at about 2K on the long side at the nearest of 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16)."
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=false; the description supplies the rest: $0.06/image max pricing, ordered fallback lanes with per-image settlement, idempotency via request_ref, credit prerequisites, and refund behavior. It also enumerates failure codes (INSUFFICIENT_CREDITS, SIMPLER_IMAGE_OUTPUT_FLAGGED, SIMPLER_IMAGE_RESULT_UNDELIVERED) and their remedies, which the annotations do not cover.

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 cost and routing, then output shape, errors, and NEXT in a logical order. It is dense but mostly earns its space; the pricing sentence ('the credit a call must have available before it runs') is slightly tangled and could be tighter.

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?

No output schema exists, but the description fully specifies the return shape ({images:[{url, asset_key, download_url?, width, height}], price, next}), preview behavior, and download_url_unavailable/pv_unavailable explanations. For a paid, multi-lane generation tool it covers everything an agent needs to call and interpret it.

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 parameters are already fully documented, including count 1-3, width/height aspect-ratio mapping, and request_ref idempotency semantics. The description adds only pricing context and empty-prompt guidance, so the baseline 3 is appropriate.

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 ('Generate 1-3 images from a text prompt') with scope (count, text prompt). It explicitly distinguishes itself from image.generate_for_edit and points to image.variation/image.upscale, so an agent can select it without opening sibling schemas.

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?

Names the alternative for edit sessions ('use image.generate_for_edit') and a distinct use case for image.variation ('for a product photo the owner already has'). The NEXT section routes follow-up calls to variation/upscale with a concrete argument (images[0].asset_key).

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