Skip to main content
Glama

Generate an image

generate_image

Generate an image from a text prompt, optionally guided by reference images (image-to-image). Returns image URLs directly. Most models finish in 10-60 seconds; if your client times out, set async=true to get a task_id you can poll instead. This call costs money — do not retry speculatively.

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

Input Schema

NameRequiredDescriptionDefault
nNoHow many images to generate. Defaults to 1. Each one is billed.
sizeNoOutput size, e.g. 1024x1024, 1536x1024, or 'auto'. Model-dependent; omit for the model default.
asyncNoSubmit asynchronously and return a task_id instead of waiting. Use when the client times out on slow models; poll with get_task using platform 'image'.
modelYesExact model name, e.g. gpt-image-2 or nano-banana-pro. Call list_models with category 'image' if unsure.
imagesNoOptional reference images as HTTPS URLs or data URLs, for image-to-image generation. Not all models accept references.
promptYesDescription of the image to generate.
qualityNoQuality hint, e.g. low, medium, high or auto. Model-dependent.
aspect_ratioNoZ-Image only: required output aspect ratio. Supported values: 1:1, 4:3, 3:4, 16:9, 9:16.
nsfw_checkerNoZ-Image only: enable or disable the upstream NSFW checker. Explicit false is preserved.
wait_secondsNoOnly with async: poll server-side for up to this many seconds (max 240) and return the finished image if it completes in time.
response_formatNo'url' (default) returns links; 'b64_json' returns base64 data, which is far larger and usually unnecessary.

Output Schema

NameRequiredDescriptionDefault
noteNoWhat to do next.
modelYesModel that served the request.
imagesNoGenerated images, when the call completed.
statusYesOne of: completed, queued, in_progress, failed.
task_idNoTask identifier, when submitted asynchronously and still running.
platformNoPass this to get_task together with task_id.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.3/5.0
Behavior5/5

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

The annotations already establish read/write and idempotency hints, and the description adds valuable behavioral details beyond them: sync latency in '10-60 seconds,' the async fallback with a task_id, and the financial consequence of the call. The warning against speculative retries is especially important given idempotentHint=false. This gives an agent realistic expectations about cost, delay, and failure handling.

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?

Four sentences deliver purpose, output format, latency guidance, and a financial warning with no filler. The most important information is front-loaded, and each sentence earns its place. This is an appropriately sized description for a tool with this many parameters.

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 tool with 11 parameters and an output schema, the description covers the essential operational context: what it does, how outputs are returned, how to handle slow models, and cost implications. The main omission is explicit routing among image-related siblings like edit_image or upscale_image, but the schema and output schema make up most of the remaining invocation details.

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 parameters are already well documented. The description goes a step further by adding meaning around key parameters: reference images are tied to image-to-image mode, async is explicitly connected to timeout handling, and 'Returns image URLs directly' clarifies the default response_format behavior. This enriches the schema without repeating its content.

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?

The description clearly states the core action: 'Generate an image from a text prompt, optionally guided by reference images (image-to-image).' It also notes the return format ('Returns image URLs directly'), which helps define what the tool produces. However, it does not explicitly distinguish itself from sibling tools such as edit_image or upscale_image, leaving some potential for confusion about when to choose this tool over those.

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?

The description provides actionable usage context: if the client times out, 'set async=true to get a task_id you can poll instead,' plus a clear cost warning: 'This call costs money — do not retry speculatively.' It does not explicitly state when to use generate_image versus edit_image or upscale_image, so it lacks the strongest possible sibling-routing guidance, but the practical wait/retry advice is useful.

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