list_workflow_templates
View all saved workflow templates in the registry. Access predefined workflows to streamline image generation tasks.
Instructions
List all saved workflow templates in the registry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/templates.ts:127-177 (handler)Handler function for the 'list_workflow_templates' tool. Reads the templates directory, lists all .json files, parses each to extract name/description/updatedAt, and returns a formatted text response.
server.tool( "list_workflow_templates", "List all saved workflow templates in the registry.", listSchema, async () => { let entries: string[]; try { entries = await fs.readdir(store.dir); } catch { return { content: [ { type: "text" as const, text: `No templates directory at ${store.dir} yet.`, }, ], }; } const names = entries .filter((f) => f.endsWith(".json")) .map((f) => f.replace(/\.json$/, "")); if (names.length === 0) { return { content: [ { type: "text" as const, text: "No templates saved yet." }, ], }; } const rows: string[] = []; for (const name of names.sort()) { try { const raw = await fs.readFile( templatePath(store.dir, name), "utf-8", ); const t = JSON.parse(raw) as StoredTemplate; const desc = t.description ? ` — ${t.description}` : ""; rows.push(` ${t.name}${desc} (updated ${t.updatedAt})`); } catch { rows.push(` ${name} (unreadable)`); } } return { content: [ { type: "text" as const, text: `Saved templates (${names.length}) in ${store.dir}:\n${rows.join("\n")}`, }, ], }; }, - src/tools/templates.ts:56-56 (schema)Schema definition for list_workflow_templates — an empty object since the tool takes no arguments.
const listSchema = {}; - src/server.ts:48-48 (registration)Registration call: registerTemplateTools(s, client, templateStore) wires all template tools (including 'list_workflow_templates') onto the MCP server.
registerTemplateTools(s, client, templateStore); - src/tools/templates.ts:70-74 (registration)Exported function registerTemplateTools that registers all workflow template tools (save, list, get, delete, run) onto the McpServer via server.tool().
export function registerTemplateTools( server: McpServer, client: ComfyUIClient, store: TemplateStore, ): void {