Skip to main content
Glama

validate_workflow

Check workflow structure for errors in ComfyUI automation to ensure proper execution before running.

Instructions

Validate a workflow structure.

Args: workflow: Workflow dict to validate Returns validation result with any issues found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflowYesWorkflow to validate

Implementation Reference

  • The handler function for the 'validate_workflow' tool. It checks the workflow for required fields like 'class_type' and 'inputs', and validates that connections reference existing nodes. Returns a dict with validity status, node count, and list of issues.
    def validate_workflow( workflow: dict = Field(description="Workflow to validate"), ctx: Context = None, ) -> dict: """Validate a workflow structure. Args: workflow: Workflow dict to validate Returns validation result with any issues found. """ if ctx: ctx.info("Validating workflow") issues = [] node_ids = set(workflow.keys()) for node_id, node in workflow.items(): # Check required fields if "class_type" not in node: issues.append(f"Node {node_id}: missing class_type") if "inputs" not in node: issues.append(f"Node {node_id}: missing inputs") # Check connections reference valid nodes if "inputs" in node: for input_name, value in node["inputs"].items(): if isinstance(value, list) and len(value) == 2: ref_node = str(value[0]) if ref_node not in node_ids: issues.append( f"Node {node_id}.{input_name}: " f"references non-existent node {ref_node}" ) return { "valid": len(issues) == 0, "node_count": len(workflow), "issues": issues, }

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/IO-AtelierTech/comfyui-mcp'

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