Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| FAL_KEY | No | Your fal.ai API key for cloud GPU inference | |
| COMFY_URL | No | ComfyUI server URL | http://localhost:8188 |
| OUTPUT_MODE | No | Output mode: file (Image) or url (string URL) | file |
| POLL_TIMEOUT | No | Max seconds to wait for workflow (1-300) | 60 |
| POLL_INTERVAL | No | Seconds between status polls (0.1-10.0) | 1.0 |
| OUTPUT_NODE_ID | No | Default output node ID | |
| PROMPT_NODE_ID | No | Default prompt node ID for generate_image | |
| COMFY_URL_EXTERNAL | No | External URL for image retrieval (defaults to same as COMFY_URL) | |
| COMFY_WORKFLOWS_DIR | No | Directory for API format workflows (execution) | |
| COMFY_WORKFLOWS_UI_DIR | No | Directory for UI format workflows (editor) | |
| COMFY_WORKFLOW_JSON_FILE | No | Default workflow file for generate_image |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| get_system_stats | Get ComfyUI server health: version, memory, device info. Returns system information including:
- ComfyUI and PyTorch versions
- RAM usage
- Device info (CPU/GPU)
Use this to verify ComfyUI is running and check resource usage.
|
| get_queue_status | Get current queue: running and pending jobs. Returns:
- queue_running: List of currently executing workflows
- queue_pending: List of queued workflows waiting to run
- running_count: Number of running jobs
- pending_count: Number of pending jobs
Use this to check if workflows are executing or queued.
|
| get_history | Get recent generation history. Args:
limit: Maximum number of history entries (1-100, default: 10)
Returns history entries with outputs and status for each job.
Use this to see past generations and their results.
|
| cancel_current | Interrupt current generation. Args:
prompt_id: Optional specific prompt ID to cancel.
If not provided, cancels all running jobs.
Use this to stop a long-running generation.
|
| clear_queue | Clear the queue or delete specific items. Args:
delete_ids: Optional list of prompt IDs to delete.
If not provided, clears entire queue.
Use this to remove pending jobs from the queue.
|
| list_nodes | List available ComfyUI nodes. Args:
filter: Optional string to match node names (case-insensitive)
category: Optional category filter (exact match)
Returns a sorted list of node class names.
Use this to discover available nodes for workflow building.
|
| get_node_info | Get detailed info about a node. Args:
node_name: Node class name (e.g., 'RemoteCheckpointLoader_fal')
Returns node information including:
- input: Required and optional inputs with types
- output: Output types
- category: Node category
- description: What the node does
Use this to understand how to configure a node in a workflow.
|
| list_models | List available models in a folder. Args:
folder: Model folder name. Options:
- checkpoints: Full model checkpoints
- loras: LoRA fine-tuning files
- vae: VAE decoders
- embeddings: Text embeddings
- controlnet: ControlNet models
- upscale_models: Upscaling models
- clip_vision: CLIP vision encoders
Returns list of model filenames in the folder.
|
| list_model_folders | List available model folder types. Returns a list of valid folder names for list_models().
|
| list_embeddings | List available text embeddings. Returns list of embedding names that can be used in prompts. |
| list_extensions | List loaded ComfyUI extensions. Returns list of installed extension names (custom node packs). Use this to verify which custom nodes are available (e.g., fal.ai connector). |
| refresh_nodes | Refresh the node cache. Call this after installing new custom nodes to see them in list_nodes().
|
| search_nodes | Search for nodes by name, category, or description. Args:
query: Search string (searches name, category, description)
Returns matching nodes sorted by relevance.
|
| list_workflows | List available workflow files. Returns list of workflow JSON files in the configured workflows directory.
Use run_workflow() to execute a saved workflow.
|
| load_workflow | Load a workflow file for inspection or modification. Args:
workflow_name: Workflow filename (e.g., 'my-workflow.json')
Returns the workflow dict that can be modified and executed.
|
| save_workflow | Save a workflow to the workflows directory. Args:
workflow: Workflow dict to save (in API format)
name: Filename (with or without .json extension).
If not provided, generates a random funny name like 'cosmic-penguin'.
format: Output format:
- 'api': Raw API format for execution (flat dict)
- 'ui': Litegraph format for ComfyUI editor (default)
Returns path to saved file or error message.
|
| create_workflow | Create an empty workflow structure. Returns an empty dict that you can populate with add_node().
|
| generate_workflow_name | Generate a random funny workflow name. Args:
words: Number of words in the name (2-4, default: 2)
Returns a slug like 'cosmic-penguin' or 'mighty-purple-narwhal'.
Use this when saving new workflows for creative naming.
|
| add_node | Add a node to a workflow. Args:
workflow: Existing workflow dict
node_id: Unique identifier for this node
node_type: Node class name (use list_nodes() to find)
inputs: Input values. For connections use ["source_node_id", output_index].
Examples:
# Simple value input
add_node(wf, "1", "StringInput_fal", {"text": "a cat"})
# Connection to another node
add_node(wf, "2", "CLIPTextEncode", {
"text": "prompt",
"clip": ["1", 0] # Connect to node "1" output 0
})
Returns the modified workflow dict.
|
| remove_node | Remove a node from a workflow. Args:
workflow: Workflow dict to modify
node_id: ID of node to remove
Warning: This doesn't update connections from other nodes.
|
| update_node_input | Update a specific input on a node. Args:
workflow: Workflow dict to modify
node_id: Node ID to update
input_name: Name of the input to update
value: New value (use JSON string for lists/dicts)
Returns the modified workflow dict.
|
| get_workflow_template | Get a pre-built workflow template. Args:
template_name: One of:
- 'empty': Empty workflow
- 'fal-flux-dev': Flux Dev via fal.ai (higher quality)
- 'fal-flux-schnell': Flux Schnell via fal.ai (faster)
Returns a workflow dict that can be modified and executed.
|
| list_templates | List available workflow templates. Returns list of template names for get_workflow_template().
|
| validate_workflow | Validate a workflow structure. Args:
workflow: Workflow dict to validate
Returns validation result with any issues found.
|
| convert_workflow_to_ui | Convert an API format workflow to UI/Litegraph format. Args:
workflow: Workflow in API format (flat dict with class_type/inputs)
Returns:
Workflow in UI format compatible with ComfyUI editor.
This format includes node positions, visual links, and metadata
required for the workflow to be displayed and edited in the UI.
The conversion:
- Assigns integer IDs to nodes
- Places nodes in a grid layout
- Creates visual links from input connections
- Sets appropriate node sizes based on type
|
| run_workflow | Execute a saved workflow file. Args:
workflow_name: Workflow filename (e.g., 'flux-dev.json')
inputs: Optional input overrides, e.g., {"6": {"text": "new prompt"}}
output_node_id: Node ID to get output from (uses default if not set)
Returns the generated image or error message.
|
| execute_workflow | Execute an arbitrary workflow dict. Args:
workflow: Workflow dict in ComfyUI API format
output_node_id: Node ID that outputs the final image
Returns the generated image or error message.
Use this for programmatically built workflows.
|
| generate_image | Generate an image using the default workflow. This is a simplified interface for quick image generation.
Requires COMFY_WORKFLOW_JSON_FILE, PROMPT_NODE_ID, and OUTPUT_NODE_ID
to be configured.
For more control, use run_workflow() or execute_workflow().
Args:
prompt: Text description of the image to generate
|
| submit_workflow | Submit a workflow without waiting for completion. Args:
workflow: Workflow dict to execute
Returns the prompt_id for tracking.
Use get_history() or get_prompt_status() to check completion.
|
| get_prompt_status | Get the status of a submitted prompt. Args:
prompt_id: The prompt ID from submit_workflow()
Returns status information including completion state.
|
| get_result_image | Get the result image from a completed prompt. Args:
prompt_id: The prompt ID from submit_workflow()
output_node_id: Node ID that produced the image
Returns the image if available, or error message.
|
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |