Skip to main content
Glama

run_workflow_from_file

Execute a ComfyUI workflow by loading it from a specified file path to automate image generation tasks.

Instructions

Run a workflow from a file.

Args:
    file_path: The absolute path to the file to run.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes

Implementation Reference

  • The main handler function for the 'run_workflow_from_file' tool. It is registered via the @mcp.tool() decorator. The function reads a JSON workflow from the specified file path, initializes a ComfyUI client, and executes the workflow, returning the generated images.
    @mcp.tool()
    async def run_workflow_from_file(file_path: str) -> Any:
        """Run a workflow from a file.
        
        Args:
            file_path: The absolute path to the file to run.
        """
        with open(file_path, "r", encoding="utf-8") as f:
            workflow = json.load(f)
        
        auth = os.environ.get("COMFYUI_AUTHENTICATION")
        comfy = ComfyUI(
            url=f'http://{os.environ.get("COMFYUI_HOST", "localhost")}:{os.environ.get("COMFYUI_PORT", 8188)}',
            authentication=auth
        )
        images = await comfy.process_workflow(workflow, {}, return_url=os.environ.get("RETURN_URL", "true").lower() == "true")
        return images
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Run') but doesn't describe what 'running a workflow' entails—whether it's a read-only operation, has side effects, requires specific permissions, or what happens upon execution. This leaves critical behavioral traits unspecified for a tool that likely performs significant operations.

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 appropriately sized and front-loaded, with the main purpose stated first and parameter details following. It avoids unnecessary elaboration, though the parameter explanation could be more integrated. The structure is efficient, but the lack of usage context slightly reduces its effectiveness.

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

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of running a workflow (likely involving execution, side effects, or outputs), the description is incomplete. With no annotations, no output schema, and minimal parameter details, it fails to provide sufficient context for safe and effective use. The agent lacks information on what 'running' entails, expected results, or error conditions.

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 semantics beyond the input schema. It explains that 'file_path' is 'The absolute path to the file to run,' which clarifies the parameter's purpose slightly, but with 0% schema description coverage and only one parameter, this is a baseline case. The description doesn't elaborate on file format requirements or path validation, leaving gaps in 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 action ('Run a workflow') and the resource ('from a file'), making the purpose understandable. It distinguishes from 'run_workflow_from_json' by specifying the source as a file rather than JSON input, but doesn't explicitly differentiate from other siblings like 'download_image' or 'text_to_image' in terms of workflow execution context.

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 when to choose 'run_workflow_from_file' over 'run_workflow_from_json', nor does it explain prerequisites like file format or workflow compatibility. Usage is implied by the name but not explicitly stated.

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/Overseer66/comfyui-mcp-server'

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