Skip to main content
Glama

get_workflow_info

Extract structural metadata from ComfyUI workflows by parsing DSL content to identify 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
NameRequiredDescriptionDefault
dslYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'get_workflow_info'. Parses the input DSL string using DSLParser, traverses the workflow AST to collect information on nodes, sections, and connections, and returns a structured dictionary with analysis results including counts and details.
    @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}")
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool 'parses DSL and extracts structural information' and doesn't execute, which is useful. However, it lacks details on permissions needed, rate limits, error handling, or what happens with invalid DSL. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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?

The description is well-structured and concise: it starts with a clear purpose statement, followed by behavioral details, then lists args and returns with brief explanations, and ends with an example. Every sentence adds value without redundancy, and it's front-loaded with key information.

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?

Given the tool's moderate complexity (analyzing workflow structure), no annotations, and an output schema exists (so return values are documented elsewhere), the description is reasonably complete. It covers purpose, behavior, parameters, and returns, though it could benefit from more behavioral context like error cases or performance notes. The output schema likely handles return details, reducing the burden on the description.

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

Parameters3/5

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

Schema description coverage is 0%, so the schema provides no parameter details. The description adds value by explaining 'dsl: Workflow content in DSL format', giving basic semantics. However, it doesn't specify the DSL format, constraints, or examples beyond the generic example, leaving room for ambiguity. With 1 parameter and low schema coverage, this is a minimal but adequate explanation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Analyze workflow structure and return metadata' with specific verbs ('analyze', 'parses', 'extracts') and resources ('workflow structure', 'DSL'). It distinguishes from siblings like execute_workflow (which runs workflows) and read_workflow (which likely reads raw content), but doesn't explicitly differentiate from validate_workflow or get_template_dsl, which might have overlapping analysis functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context: 'without executing the workflow' suggests this is for inspection rather than execution, distinguishing it from execute_workflow. However, it doesn't provide explicit when-to-use guidance versus alternatives like validate_workflow (which might also analyze structure) or get_template_dsl (which might return DSL content), nor does it mention prerequisites or exclusions.

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/christian-byrne/comfy-mcp'

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