get_workflow_info
Analyze ComfyUI workflow structure to extract metadata like node types, sections, and connections without execution.
Instructions
Analyze workflow structure and return metadata.
Parses DSL and extracts structural information like node types, sections, and connections without executing the workflow.
Args: dsl: Workflow content in DSL format
Returns: Workflow metadata including nodes, sections, and connections
Examples: get_workflow_info(dsl_content)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dsl | Yes |
Implementation Reference
- comfy_mcp/mcp/server.py:279-345 (handler)The handler function for the 'get_workflow_info' tool. It parses the input DSL string using DSLParser, traverses the workflow AST to collect statistics on nodes, sections, and connections, and returns a comprehensive metadata dictionary.@mcp.tool def get_workflow_info(dsl: str) -> dict: """Analyze workflow structure and return metadata. Parses DSL and extracts structural information like node types, sections, and connections without executing the workflow. Args: dsl: Workflow content in DSL format Returns: Workflow metadata including nodes, sections, and connections Examples: get_workflow_info(dsl_content) """ try: parser = DSLParser() workflow_ast = parser.parse(dsl) # Collect node information node_types = [] sections = [] connections = [] for section in workflow_ast.sections: section_info = { "name": section.header, "node_count": len(section.nodes), "nodes": [] } for node in section.nodes: node_types.append(node.node_type) section_info["nodes"].append({ "name": node.name, "type": node.node_type, "property_count": len(node.properties) }) # Find connections for prop in node.properties: if isinstance(prop.value, Connection): connections.append({ "from": prop.value.node, "output": prop.value.output, "to": node.name, "input": prop.name }) sections.append(section_info) # Count unique node types node_type_counts = dict(Counter(node_types)) return { "node_count": len(node_types), "section_count": len(sections), "connection_count": len(connections), "node_types": node_type_counts, "sections": sections, "connections": connections } except Exception as e: raise ToolError(f"Error analyzing workflow: {e}")