Skip to main content
Glama

comfyui_generate_image

Create images from text, edit a reference image while preserving subject identity, or resize and remove backgrounds. Get a prompt ID to poll or wait for direct image URLs.

Instructions

Generate, modify, or post-process images using ComfyUI. Three modes (auto-detected):

  • txt2img: Provide prompt → generates image from text

  • img2img: Provide prompt + image_path → edits the reference image using Flux 2 Klein's native edit pattern (ReferenceLatent + CFGGuider), which preserves character/subject identity far better than classic denoise-based img2img. Best results at ~1MP references; 128×128 inputs will be upscaled before encoding.

  • post-process: Provide image_path without prompt → resize and/or remove background only

By default, returns immediately with a prompt_id and status 'queued'. Use comfyui_get_image to poll for completion and retrieve image URLs. Set wait: true to block until the image is ready (or fails/times out) and get image URLs directly in the response.

Parameters:

  • prompt (string, optional): Text description of desired image

  • negative_prompt (string, optional): What to avoid in the image

  • image_path (string, optional): Absolute path to input image (triggers img2img or post-process)

  • width/height (int, optional): Target output dimensions (triggers resize post-processing)

  • remove_background (boolean, optional): Remove background from output image

  • loras (array, optional, max 4): LoRA stack. Each entry: { name, strength_model (-2..2, default 1.0), strength_clip (optional, defaults to strength_model) }. Omit to fall back to COMFYUI_DEFAULT_LORAS env (if set). Pass [] to explicitly disable defaults. Use comfyui_list_loras to discover available names.

  • wait (boolean, optional, default false): Block until image is ready and return URLs directly

Must provide at least prompt or image_path.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "comfyui_generate_image"
  }
}

Input Schema

NameRequiredDescriptionDefault
waitNo
lorasNo
widthNo
heightNo
promptNo
image_pathNo
negative_promptNo
remove_backgroundNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.1.0

TDQS

A4.7/5.0
Behavior4/5

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

Annotations only declare it is a non-read-only, non-destructive, non-idempotent call; the description adds the substantive traits — asynchronous queuing with prompt_id/status, an opt-in blocking path, auto-detection of mode, automatic upscaling of tiny references, and the COMFYUI_DEFAULT_LORAS fallback. It stops short of stating where output files land or what happens on timeout beyond 'fails/times out', so it is strong but not exhaustive.

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 with a one-line purpose, then mode bullets, then a parameter list — the ordering matches how an agent reads. Slight redundancy in restating schema types ("string, optional", "default false") and the multi-line img2img rationale is longer than strictly needed, but no sentence is wasted for a tool of this complexity.

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, yet the description explains what the response contains in both async (prompt_id + status 'queued') and blocking (direct image URLs) modes, and the retrieval path via the sibling tool. For an eight-parameter generator with no schema documentation, this is complete enough to call correctly on the first attempt.

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 load and does so: every one of the eight parameters is explained, plus nested LoRA entry semantics (strength_model vs. strength_clip inheritance), the trailing-omission-vs-empty-array distinction, and the cross-parameter constraint "Must provide at least prompt or image_path" that the schema does not encode.

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, modify, or post-process images using ComfyUI") and then enumerates three concrete modes with the input signature that selects each. An agent can distinguish this from comfyui_get_image purely from this text.

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?

Explicitly routes the agent: default returns a prompt_id to be polled with comfyui_get_image, while wait:true blocks for direct URLs, and comfyui_list_loras is named for name discovery. Mode selection conditions (prompt alone vs. prompt+image_path vs. image_path alone) are spelled out rather than implied.

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