Skip to main content
Glama

run_workflow_from_json

Execute ComfyUI workflows by providing JSON data to generate images through natural language interactions.

Instructions

Run a workflow from a JSON data.

Args:
    json_data: The JSON data to run.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
json_dataYes

Implementation Reference

  • The handler function for the 'run_workflow_from_json' MCP tool, registered via @mcp.tool(). It receives JSON workflow data, initializes a ComfyUI client, and executes the workflow, returning the generated images.
    @mcp.tool()
    async def run_workflow_from_json(json_data: dict) -> Any:
        """Run a workflow from a JSON data.
        
        Args:
            json_data: The JSON data to run.
        """
        workflow = json_data
        
        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

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