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
| Name | Required | Description | Default |
|---|---|---|---|
| json_data | Yes |
Implementation Reference
- src/server.py:62-77 (handler)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