list_workflows
Discover available ComfyUI workflow files stored on disk to identify templates for AI image generation tasks.
Instructions
List all ComfyUI workflow files that are available on disk.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_preview | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/comfyui_mcp/server.py:262-281 (handler)The asynchronous handler function that executes the list_workflows tool, iterating over workflow files, gathering metadata, optionally including file previews, and returning a structured list.
async def list_workflows(include_preview: bool = False, context: Context | None = None) -> dict[str, Any]: """Return metadata about workflows stored on disk.""" entries = [] for workflow in workflow_repo.iter_workflows(): description = workflow_repo.describe(workflow) if include_preview: preview = await anyio.to_thread.run_sync( workflow.read_text, "utf-8" ) description["preview"] = preview entries.append(description) entries.sort(key=lambda item: item["relative_path"]) if context is not None: await context.info(f"Found {len(entries)} workflow files") return { "workflow_root": str(workflow_repo.root), "count": len(entries), "workflows": entries, } - src/comfyui_mcp/server.py:258-261 (registration)Registers the list_workflows tool on the FastMCP server instance, specifying its name and description.
@server.tool( name="list_workflows", description="List all ComfyUI workflow files that are available on disk.", )