Skip to main content
Glama

load_workflow

Load a ComfyUI workflow file to inspect its structure or prepare it for modifications and execution.

Instructions

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.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflow_nameYesWorkflow filename

Implementation Reference

  • The core handler function for the 'load_workflow' tool. It uses Pydantic Field for input schema validation, loads the specified workflow JSON file from the configured directory, handles errors like missing directory or file, and returns the workflow dictionary.
    @mcp.tool()
    def load_workflow(
        workflow_name: str = Field(description="Workflow filename"),
        ctx: Context = None,
    ) -> dict:
        """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.
        """
        if not settings.workflows_dir:
            return ErrorResponse.not_configured("COMFY_WORKFLOWS_DIR").model_dump()
    
        wf_path = Path(settings.workflows_dir) / workflow_name
        if not wf_path.exists():
            return ErrorResponse.not_found(
                f"Workflow '{workflow_name}'",
                suggestion="Use list_workflows() to see available workflows",
            ).model_dump()
    
        if ctx:
            ctx.info(f"Loading workflow: {workflow_name}")
    
        with open(wf_path) as f:
            return json.load(f)
  • Within register_all_tools, this line calls register_workflow_tools(mcp), which defines and registers the load_workflow tool using @mcp.tool() decorator.
    register_workflow_tools(mcp)
  • The top-level call to register_all_tools(mcp) in the package init, which triggers the registration chain leading to load_workflow being registered.
    register_all_tools(mcp)
  • Pydantic Field defining the input schema for the workflow_name parameter of the load_workflow tool.
    workflow_name: str = Field(description="Workflow filename"),
    ctx: Context = None,
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 of behavioral disclosure. It mentions that the tool loads a workflow 'for inspection or modification' and returns a 'workflow dict that can be modified and executed', which hints at mutability and potential side effects. However, it lacks details on permissions, error handling, or whether loading affects system state (e.g., locks the file). For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is well-structured and concise, with three sentences that efficiently convey purpose, parameters, and return value. There's no wasted text, and key information is front-loaded. However, the use of a code block for Args/Returns slightly disrupts flow, though it remains readable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/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 (1 parameter, no output schema, no annotations), the description is partially complete. It covers the basic purpose and return value but lacks usage guidelines, behavioral details, and output specifics. Without annotations or an output schema, more context on what the 'workflow dict' contains or how to use it would be beneficial for the agent.

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?

The description adds minimal value beyond the input schema. It repeats the parameter name and provides an example ('my-workflow.json'), but the schema already has 100% coverage with a clear description ('Workflow filename'). Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't significantly enhance parameter understanding.

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: 'Load a workflow file for inspection or modification.' It specifies the verb ('load') and resource ('workflow file'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_workflow_template' or 'list_workflows', which might have overlapping functions.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, when not to use it, or compare it to siblings like 'get_workflow_template' or 'list_workflows'. The agent must infer usage from the purpose alone, which is insufficient for optimal tool selection.

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

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