list_workflows
Retrieve available workflow JSON files from the configured directory to identify saved workflows for execution.
Instructions
List available workflow files.
Returns list of workflow JSON files in the configured workflows directory.
Use run_workflow() to execute a saved workflow.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The core handler function for the 'list_workflows' tool. It lists all *.json workflow files in the configured workflows directory, handling missing directory errors.def list_workflows(ctx: Context = None) -> list: """List available workflow files. Returns list of workflow JSON files in the configured workflows directory. Use run_workflow() to execute a saved workflow. """ if not settings.workflows_dir: return ["Error: COMFY_WORKFLOWS_DIR not configured"] if ctx: ctx.info(f"Listing workflows in: {settings.workflows_dir}") path = Path(settings.workflows_dir) if not path.exists(): return [] return sorted([f.name for f in path.glob("*.json")])
- src/comfy_mcp_server/tools/__init__.py:23-29 (registration)The register_all_tools function calls register_workflow_tools(mcp), which in turn defines and registers the list_workflows tool via @mcp.tool() decorator.def register_all_tools(mcp): """Register all tools with the MCP server.""" register_system_tools(mcp) register_discovery_tools(mcp) register_workflow_tools(mcp) register_execution_tools(mcp)
- src/comfy_mcp_server/__init__.py:92-92 (registration)Top-level call to register_all_tools(mcp) during server initialization, which ultimately registers the list_workflows tool.register_all_tools(mcp)