Skip to main content
Glama

run_comfyscript

Run complex ComfyUI workflows as Python scripts, simplifying multi-stage graph authoring that JSON cannot easily express.

Instructions

Author and run a ComfyUI workflow as Python via ComfyScript — runs on spark in the comfyui venv against the live server. Use this for COMPLEX/multi-stage graphs (LTX-2.3 audio, two-stage pipelines) that are awkward to express as JSON or drive via the GUI. Provide a snippet with a with Workflow(wait=True): block ending in SaveImage(...)/SaveVideo(...); the imports + load() are auto-prepended. Every server node (incl. custom: HunyuanImage3Generate, LTXV*, RES4LYF samplers) is available as a function. Returns the new output filenames (view with view_image) plus an output tail. Heavy models (HunyuanImage-3.0 ~13min) need a high timeout_sec.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesComfyScript Python. Nodes are functions whose positional args follow each node's required-input order, e.g.: model,clip,vae = CheckpointLoaderSimple('cyberrealisticXL_v90.safetensors'); pos = CLIPTextEncode('a tiger', clip); neg = CLIPTextEncode('blurry', clip); latent = KSampler(model, 42, 28, 6.0, 'dpmpp_2m', 'karras', pos, neg, EmptyLatentImage(896,1152,1), 1.0); SaveImage(VAEDecode(latent, vae), 'out'). Wrap in `with Workflow(wait=True):`.
timeout_secNoMax seconds to wait (default 900, max 1800).
Behavior4/5

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

No annotations, so description carries the full burden. It discloses the execution environment (spark, comfyui venv), auto-prepending of imports/load(), return value (filenames + output tail), and performance timeout considerations. However, it doesn't detail error handling or side effects on the server.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Six dense sentences, each adding value: purpose, when to use, required script structure, capability, return value, and timeout note. No fluff or repetition.

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 code-execution tool with two well-documented parameters, the description is quite complete: it gives environment, usage, return format, and performance caveat. Lacks explicit failure-mode information but that's not critical for selection.

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

Parameters4/5

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

Schema covers 100% of params with detailed descriptions and examples, so baseline is 3. The tool description adds extra semantics: auto-prepended imports, availability of all server nodes as functions, and heavy model timeout guidance, which enhance understanding beyond the schema.

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?

Clearly states it authors and runs ComfyUI workflows as Python via ComfyScript, with specific reference to complex graphs. Distinguishes from siblings like queue_workflow by noting it's for graphs awkward to express as JSON or GUI-driven.

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?

Explicitly says to use for complex/multi-stage graphs (LTX-2.3, two-stage) and implies JSON/GUI as alternatives. Doesn't name sibling tools but provides context. Missing a direct 'when not to use' but the positive use-case is strong.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bernardogv/comfyui-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server