Skip to main content
Glama

generate_image

Create images from text prompts or edit existing images with reference images, masks, and denoise controls for offline GPU-based generation.

Instructions

Generate images from a text prompt, optionally guided by reference images.

Without reference_images the default model is Z-Image Turbo (1024x1024, 8 steps). reference_images: up to 4 local image paths to edit or combine; the prompt says what to do with them (for example "change the jacket to red", "the person from image 1 in the setting of image 2"). This uses FLUX.2 Klein 4B; output size follows the first reference unless width and height are given. input_image: a local image to start from (image to image) instead of noise. The output keeps its size (width and height are not allowed); it is worked on at about 1 megapixel. The prompt describes the whole desired result, not only the change. denoise (0.05 to 1.0, needs input_image): how much may change. Z-Image Turbo default 0.6. Z-Image holds on to the input strongly: 0.3 and 0.6 change only fine detail, 0.9 keeps the layout but changes colours and materials, 1.0 ignores the input (except outside a mask). mask_image (needs input_image): a black and white image, white = change, black = keep; any size (it is stretched to input_image). Only the white area is regenerated, and the result is pasted back over input_image with an 8 pixel feathered edge, so every pixel more than about 18 px outside the white area is exactly the original. To replace what is in the region use denoise 1.0; to recolour an object, Klein (model="flux2-klein-4b") follows the prompt better than Z-Image at 0.9, which keeps some of the old colour. input_image with reference_images (or model="flux2-klein-4b"): FLUX.2 Klein edits input_image as image 1 and the references are images 2 to 4 (at most 3), for example "give the person in image 1 the hat from image 2"; Klein's denoise default is 1.0 (a full edit guided by image 1), and mask_image limits it to a region the same way. count > 1 queues all images at once (one model load); seeds are seed, seed+1, ... Returns absolute PNG paths, the seeds and settings used, timings and the effective backend idle timeout. Default output folder: /ai/output/localgen/image//. idle_timeout_seconds: keep the backend up this long after the last call (bounded, default 300).

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
seedNo
countNo
modelNo
stepsNo
widthNo
heightNo
promptYes
denoiseNo
mask_imageNo
output_dirNo
input_imageNo
reference_imagesNo
idle_timeout_secondsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so: it discloses default model/resolution/step counts, that width/height are not allowed with input_image, denoise semantics at specific values (0.3/0.6/0.9/1.0), the 8px feathered mask paste-back with the ~18px preservation guarantee, that count>1 batches under one model load with seed, seed+1, ..., the return payload (PNG paths, seeds, settings, timings, backend idle timeout), and default output folder.

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 the one-line purpose and then organizes the rest by parameter lead-in, so an agent can scan to the mode it needs. Every sentence carries substantive information, but the unbroken multi-clause paragraphs (especially the denoise/mask block) are dense enough that key constraints are harder to extract than a list format would allow.

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 13-parameter generation tool with zero annotations, no schema descriptions, and no output schema, this covers the full decision surface: model selection, sizing rules, denoise ranges, masking behavior, batching, and return contents. Remaining gaps (error conditions, the output_dir parameter name) are minor relative to what is disclosed.

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 coverage is 0% across 13 parameters, so the description must compensate and largely does: denoise, mask_image, input_image, reference_images, model, seed, count, width/height, steps (via '8 steps'), and idle_timeout_seconds all get meaning and constraints. Only output_dir is conveyed indirectly through the 'Default output folder: /ai/output/localgen/image/<date>/' line rather than named as a parameter.

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?

Opens with a specific verb+resource: 'Generate images from a text prompt, optionally guided by reference images,' and then enumerates the distinct modes (text-to-image, image-to-image with input_image, multi-reference editing with reference_images, masked inpainting). The core purpose is unmistakable, but it never names or contrasts a sibling such as upscale_image, remove_background, or generate_video, so the agent must infer the boundary itself.

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?

Gives explicit when-to-use routing between the three image-input modes: reference_images for editing/combining, input_image for image-to-image 'instead of noise', mask_image for region-only regeneration. It goes further with decision rules—'To replace what is in the region use denoise 1.0; to recolour an object, Klein ... follows the prompt better than Z-Image at 0.9'—which is exactly the kind of conditional guidance that prevents wrong invocation.

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