| name | workflows |
| description | Knowledge about ComfyUI workflow API format, node connections, and common patterns. Use when helping users build, modify, or understand workflows. |
ComfyUI Workflow Building Guide
API Format
ComfyUI workflows use a JSON format where each node is a key-value pair:
{
"1": {
"class_type": "KSampler",
"inputs": {
"seed": 42,
"steps": 20,
"cfg": 7.0,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1.0,
"model": ["2", 0],
"positive": ["3", 0],
"negative": ["4", 0],
"latent_image": ["5", 0]
}
}
}
- Keys are string node IDs (e.g.,
"1", "2")
class_type is the ComfyUI node type name
inputs contains parameters and connections
- Connections use the format
["source_node_id", output_index]
Common Node Chains
txt2img (text to image)
CheckpointLoaderSimple -> CLIPTextEncode (positive) -> KSampler -> VAEDecode -> SaveImage
img2img (image to image)
LoadImage -> VAEEncode -> KSampler (with denoise < 1.0) -> VAEDecode -> SaveImage
ControlNet
LoadImage -> ControlNetLoader + ControlNetApply -> feed into KSampler positive conditioning
LoRA Stacking
CheckpointLoaderSimple -> LoraLoader (chain multiple) -> KSampler
Key Nodes Reference
| Node | Purpose | Key Inputs |
|---|
CheckpointLoaderSimple | Load a model checkpoint | ckpt_name |
CLIPTextEncode | Encode text prompt | text, clip |
KSampler | Run diffusion sampling | model, positive, negative, latent_image, steps, cfg, seed |
VAEDecode | Decode latent to image | samples, vae |
VAEEncode | Encode image to latent | pixels, vae |
SaveImage | Save output image | images, filename_prefix |
LoadImage | Load input image | image (filename) |
LoraLoader | Apply LoRA weights | model, clip, lora_name, strength_model, strength_clip |
ControlNetLoader | Load ControlNet model | control_net_name |
ControlNetApply | Apply ControlNet | conditioning, control_net, image, strength |
Using the Workflow Tools
Quick decision guide — pick the tool by what you need to do:
| Goal | Tool |
|---|
| Build a new workflow from scratch | comfyui_create_workflow |
| Modify an existing workflow | comfyui_modify_workflow |
| Understand a workflow (human-readable text or Mermaid) | comfyui_summarize_workflow |
| Understand a workflow (machine-readable dict) | comfyui_analyze_workflow |
| Check a workflow for errors before running | comfyui_validate_workflow |
| Execute a workflow | comfyui_run_workflow |
comfyui_create_workflow — Start from a built-in template. Accepted template names are listed in the tool's docstring: txt2img, img2img, upscale, inpaint, txt2vid_animatediff, txt2vid_wan, controlnet_canny, controlnet_depth, controlnet_openpose, ip_adapter, lora_stack, face_restore, flux_txt2img, sdxl_txt2img. The params argument defaults to "", which applies the predefined settings for the selected template (e.g., default dimensions, steps, and cfg values baked into that template); pass a JSON string when you want overrides. (Note: comfyui_list_workflows returns server-side /workflow_templates from front-end packages — a different set, not these MCP-built-in templates.)
comfyui_modify_workflow — Add/remove nodes, change connections, update parameters on an existing workflow. Operations: add_node, remove_node, set_input, connect, disconnect. The docstring spells out each op's exact field shape. The call is atomic — if any operation fails, the call raises and the input workflow is unmodified.
comfyui_validate_workflow — Returns {valid, errors, warnings, node_count, pipeline}. errors (list[str]) are blocking; warnings (list[str]) are non-blocking concerns like missing model files or suspicious inputs.
comfyui_summarize_workflow — Human-readable overview. Pass output_format="text" (default) or "mermaid" for diagram markup.
comfyui_analyze_workflow — Returns the analysis as a structured dict (node_count, class_types, flow, models, parameters, pipeline, prompt_nodes, negative_nodes). Use this when you want to read fields like pipeline programmatically; use comfyui_summarize_workflow for the human-readable rendering.
comfyui_run_workflow — Submit a workflow for execution. Use wait=True to block until done. The response is always a dict envelope: {status, prompt_id, outputs, elapsed_seconds, warnings?} where status is one of submitted / completed / interrupted / error / timeout. With wait=False you get just {status: "submitted", prompt_id, warnings?} — poll comfyui_get_progress or comfyui_get_job to follow up.
Tips
- Always validate a workflow before running it.
- Use
comfyui_list_nodes to check what node types are available on the connected ComfyUI instance.
- Use
comfyui_get_node_info to get detailed input/output specs for a specific node type.
- Node IDs must be unique strings. When adding nodes, pick IDs that don't conflict with existing ones.
- The
seed parameter controls reproducibility. Use a fixed seed for consistent results, or -1 for random.