list_workflow_templates
Retrieve a catalog of all saved workflow templates in the registry, enabling users to browse, select, and reuse predefined workflows.
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)The actual handler function for the 'list_workflow_templates' tool. It reads the templates directory, filters .json files, parses StoredTemplate metadata (name, description, updatedAt), and returns a formatted list.
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)The schema for list_workflow_templates — an empty object (no input parameters required).
const listSchema = {}; - src/server.ts:48-48 (registration)The registration call: registerTemplateTools(s, client, templateStore) is invoked during server construction, which registers all template tools including 'list_workflow_templates' on the MCP server.
registerTemplateTools(s, client, templateStore); - src/tools/templates.ts:70-75 (registration)The registerTemplateTools function that registers 'list_workflow_templates' (and other template tools) onto the McpServer instance via server.tool().
export function registerTemplateTools( server: McpServer, client: ComfyUIClient, store: TemplateStore, ): void { server.tool(