Skip to main content
Glama

generate_image

Idempotent

Generate a single image from a natural-language text prompt and save it to a chosen directory, with control over aspect ratio, resolution, seed, and PNG/JPG/WebP format.

Instructions

Generate a single image from a text prompt.

PROMPT WRITING RULES (call get_model_info first for model-specific guidance):

  • Write as natural language prose, NOT comma-separated tags.

  • Put the subject first (first 10-20 words carry the most weight).

  • Always describe lighting explicitly.

  • 30-80 words ideal. Do NOT use quality tags like '8k, masterpiece'.

  • For photorealism: reference real cameras/lenses ('Shot on Sony A7IV, 85mm f/2.0').

  • For text in images: use quotation marks ('The sign reads "OPEN"').

Args: prompt: Natural language description of the image. Describe the subject first, then environment, style, and lighting. Be specific and descriptive. output_dir: Directory to save the image. Provide a path appropriate for the user's project (e.g. "./assets/images", "./public/img", "./output"). negative_prompt: What to avoid (only works with Qwen-Image models, ignored by FLUX). For Qwen, good defaults: 'blurry, low quality, distorted, watermark, oversaturated'. width: Image width in pixels (must be multiple of 16). height: Image height in pixels (must be multiple of 16). aspect_ratio: Shortcut for resolution, e.g. "16:9", "1:1", "9:16", "16:9_2k", "16:9_4k" (overrides width/height). FLUX Klein supports up to 4K. num_inference_steps: Number of diffusion steps (fewer = faster, more = higher quality). guidance_scale: CFG scale. For Qwen-Image: raise to 7.0 for text-heavy images. seed: Random seed for reproducibility. filename: Output filename (auto-generated if omitted). format: Output image format. Options: "png" (lossless, default), "jpg" (lossy, quality=95, good for general use), "webp" (lossy, quality=90, smallest files, ideal for web projects). Choose based on context.

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

Input Schema

NameRequiredDescriptionDefault
seedNo
widthNo
formatNopng
heightNo
promptYes
filenameNo
output_dirYes
aspect_ratioNo
guidance_scaleNo
negative_promptNo
num_inference_stepsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only cover the safety profile (readOnly=false, destructive=false, idempotent=true), while the description adds substantial behavior the agent could not otherwise know: output_dir is where files land, aspect_ratio overrides width/height, negative_prompt is ignored by FLUX, and format trade-offs (png lossless, jpg q95, webp q90). Per-model quirks (Qwen guidance_scale, FLUX Klein 4K) are exactly the kind of context annotations cannot carry.

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-loaded one-line purpose, then a clearly labeled rules block, then per-arg notes — easy to scan. Slight duplication: prompt-writing advice appears both in the rules block and again in the prompt arg, costing a little length.

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?

An output schema exists so return values need no explanation, every parameter is covered, and model-conditional behavior plus the get_model_info prerequisite are documented. Nothing an agent needs to call this correctly appears to be absent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description carries the full burden, and it documents all 11 parameters: width/height multiples of 16, aspect_ratio string forms and override behavior, seed reproducibility, and filename auto-generation. This is meaning well beyond the bare types in the schema.

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?

States a specific verb and resource ("Generate a single image from a text prompt") and the word "single" implicitly separates it from batch-oriented siblings. It never names an alternative tool, so the differentiation is only partly spelled out.

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?

Gives a concrete prerequisite ("call get_model_info first for model-specific guidance") plus detailed prompt-writing rules with per-model caveats. It stops short of saying when to prefer a batch or estimate tool for multi-image or cost-preview workflows.

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