Skip to main content
Glama

Generate Image

generate_image

Create images from text prompts with flux-2-klein or qwen-image-2.1; save each result to a unique file and return the path plus temporary source URL.

Instructions

Generate an image from a text prompt with flux-2-klein (default) or qwen-image-2.1 (NaN API). qwen-image-2.1 is text-to-image only and renders text inside the image more cleanly; use edit_image when you already have reference images to transform. Saves each image under NAN_OUTPUT_DIR (default ~/nan-mcp-output) and never overwrites: a taken name gets -2, -3, and so on. Returns the saved path and the temporary source URL. Counts against the account image quota (100/month, shared by both image models).

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 to generate (1-4). Default 1. Each one counts against the monthly quota
seedNoBase seed for reproducibility. qwen-image-2.1 requires an integer from 0 to 2147483647
sizeNoImage size "WxH" divisible by 16, e.g. 1024x1024, 1536x1024, 1024x1536. flux-2-klein: 256-1536 px per side; qwen-image-2.1: 512-1280 px per side. Aspect ratio 1:3-3:1. Default 1024x1024
modelNoImage model: "flux-2-klein" (default; text to image) or "qwen-image-2.1" (text to image with cleaner text rendering; 512-1280 px, seed 0-2147483647, no guidance)
promptYesTextual description of the image to generate
guidanceNoFLUX guidance scale (flux-2-klein only)
outputNameNoOptional base name for the output file(s). Sanitised to a safe filename; an existing name is never overwritten

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.4.0
    • changedInput schema / properties / guidance / description
      Previous value: -"FLUX guidance scale"New value: +"FLUX guidance scale (flux-2-klein only)"
    • addedInput schema / properties / model
      Added value: +{
      +  "description": "Image model: \"flux-2-klein\" (default; text to image) or \"qwen-image-2.1\" (text to image with cleaner text rendering; 512-1280 px, seed 0-2147483647, no guidance)",
      +  "enum": [
      +    "flux-2-klein",
      +    "qwen-image-2.1"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / seed / description
      Previous value: -"Base seed for reproducibility"New value: +"Base seed for reproducibility. qwen-image-2.1 requires an integer from 0 to 2147483647"
    • changedInput schema / properties / size / description
      Previous value: -"Image size \"WxH\" divisible by 16, e.g. 1024x1024, 1536x1024, 1024x1536. Default 1024x1024"New value: +"Image size \"WxH\" divisible by 16, e.g. 1024x1024, 1536x1024, 1024x1536. flux-2-klein: 256-1536 px per side; qwen-image-2.1: 512-1280 px per side. Aspect ratio 1:3-3:1. Default 1024x1024"
  2. Changed2 schema fields changedv1.1.0
    • changedInput schema / properties / n / description
      Previous value: -"Number of images to generate (1-4). Default 1"New value: +"Number of images to generate (1-4). Default 1. Each one counts against the monthly quota"
    • changedInput schema / properties / outputName / description
      Previous value: -"Optional base name for the output file(s)"New value: +"Optional base name for the output file(s). Sanitised to a safe filename; an existing name is never overwritten"
  3. First observedv1.0.6

TDQS

A4.3/5.0
Behavior4/5

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

No annotations exist, so the description carries the whole burden, and it does substantial work: it discloses the output location and NAN_OUTPUT_DIR default, the non-overwriting -2/-3 naming rule, what is returned (saved path plus temporary source URL), and that each image draws on a 100/month account quota shared across both models. Gaps remain around failure handling (does a failed generation consume quota?) and whether calls are synchronous, but the operational profile is far richer than typical.

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?

The description is dense and front-loaded: purpose first, then sibling routing, then side effects, then return values, then cost. Every sentence carries information, though 'qwen-image-2.1 is text-to-image only' mildly duplicates the schema's model description and the model name appears more often than needed.

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 7-parameter generative tool with no annotations and no output schema, the description covers the important unknowns: where files land, overwrite behavior, return shape, and quota cost. It stops short of covering error cases or whether a failed run is billed, which matters given the explicit quota framing.

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 all seven parameters are already documented in the schema, and the description largely restates the model enum rather than adding new syntax. It does add a small amount of meaning beyond the schema by explaining why one would choose qwen-image-2.1 (cleaner text rendering) and by tying image count to quota consumption. Baseline 3 is appropriate given the schema does the heavy lifting.

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+resource ('Generate an image from a text prompt') and immediately names the two supported models with their defaults, so an agent knows exactly what the tool produces and which engine runs. It also distinguishes itself from the sibling edit_image, which covers the transform-with-references case.

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?

It gives an explicit routing rule with the condition attached: 'use edit_image when you already have reference images to transform.' It also states when to pick qwen-image-2.1 over the default (cleaner in-image text rendering) and that qwen is text-to-image only, which is exactly the kind of model-selection guidance an agent needs before calling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.