comfy_list_workflows
Find and filter saved ComfyUI workflows by name, description, or tags to quickly locate specific image generation pipelines.
Instructions
List all saved workflows in the MCP library. Supports filtering by name, description, or tags.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | ||
| tags | No |
Input Schema (JSON Schema)
{
"properties": {
"filter": {
"type": "string"
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
}
Implementation Reference
- src/tools/workflows.ts:131-153 (handler)The handler function for 'comfy_list_workflows' tool that lists workflows from the library using the filesystem helper, formats the response, and handles errors.export async function handleListWorkflows(input: ListWorkflowsInput) { try { const workflows = listWorkflowsInLibrary(input.filter, input.tags); return { content: [{ type: "text", text: JSON.stringify({ workflows, total_count: workflows.length }, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: JSON.stringify(ComfyUIErrorBuilder.executionError(error.message), null, 2) }], isError: true }; } }
- src/types/tools.ts:99-102 (schema)Zod schema defining the input for the comfy_list_workflows tool: optional filter string and tags array.export const ListWorkflowsSchema = z.object({ filter: z.string().optional(), tags: z.array(z.string()).optional() });
- src/server.ts:102-106 (registration)Registration of the 'comfy_list_workflows' tool in the MCP server's listTools handler, including name, description, and input schema.{ name: 'comfy_list_workflows', description: 'List all saved workflows in the MCP library. Supports filtering by name, description, or tags.', inputSchema: zodToJsonSchema(ListWorkflowsSchema) as any, },
- src/utils/filesystem.ts:209-248 (helper)Core helper function that scans the workflow library directory, reads JSON files, applies filters by name/description/tags, and returns workflow metadata.export function listWorkflowsInLibrary(filter?: string, tags?: string[]): any[] { ensureWorkflowLibraryExists(); const config = getConfig(); const libraryPath = getFullPath(config.paths.workflow_library); const files = readdirSync(libraryPath); const workflows = []; for (const file of files) { if (!file.endsWith('.json')) continue; const filePath = join(libraryPath, file); const stat = statSync(filePath); const data = JSON.parse(readFileSync(filePath, 'utf-8')); // Apply filters if (filter && !data.name?.includes(filter) && !data.description?.includes(filter)) { continue; } if (tags && tags.length > 0) { const workflowTags = data.tags || []; if (!tags.some((tag: string) => workflowTags.includes(tag))) { continue; } } workflows.push({ name: data.name, description: data.description, tags: data.tags, created_at: data.created_at, updated_at: data.updated_at, size: stat.size }); } return workflows; }