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

Tool Definition Quality

Score is being calculated. Check back soon.

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