read_workflow
Read a workflow file from the configured directory using its relative path to access ComfyUI templates for AI image generation orchestration.
Instructions
Read a specific workflow file by its relative path inside the configured workflow directory.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| relative_path | Yes |
Implementation Reference
- src/comfyui_mcp/server.py:283-305 (handler)The @server.tool decorator registers and defines the handler function for the 'read_workflow' tool. It reads the workflow file content using WorkflowRepository.read, attempts to parse it as JSON, and returns a dictionary with the relative path, raw text, and parsed JSON object.@server.tool( name="read_workflow", description=( "Read a specific workflow file by its relative path inside the" " configured workflow directory." ), ) async def read_workflow(relative_path: str, context: Context | None = None) -> dict[str, Any]: """Return the contents of a workflow JSON file.""" text = await anyio.to_thread.run_sync(workflow_repo.read, relative_path) parsed: Any try: parsed = json.loads(text) except json.JSONDecodeError: parsed = None if context is not None: await context.info(f"Read workflow {relative_path}") return { "relative_path": relative_path, "text": text, "json": parsed, }
- src/comfyui_mcp/server.py:283-289 (registration)Tool registration via @server.tool decorator specifying the name 'read_workflow' and its description.@server.tool( name="read_workflow", description=( "Read a specific workflow file by its relative path inside the" " configured workflow directory." ), )