delete_workflow_template
Remove a saved workflow template by name to keep your template list organized.
Instructions
Delete a saved workflow template.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Template name to delete. |
Implementation Reference
- src/tools/templates.ts:198-215 (handler)The handler for the 'delete_workflow_template' tool. It validates the name, deletes the template file via fs.unlink, and returns a confirmation message.
server.tool( "delete_workflow_template", "Delete a saved workflow template.", deleteSchema, async (args) => { validateName(args.name); try { await fs.unlink(templatePath(store.dir, args.name)); } catch { throw new Error(`Template "${args.name}" not found.`); } return { content: [ { type: "text" as const, text: `Deleted template "${args.name}".` }, ], }; }, ); - src/tools/templates.ts:62-64 (schema)The schema (deleteSchema) for the delete_workflow_template tool, defining the 'name' parameter as a zod string.
const deleteSchema = { name: z.string().describe("Template name to delete."), }; - src/server.ts:48-48 (registration)Where registerTemplateTools is called, registering all template tools (including delete_workflow_template) on the MCP server.
registerTemplateTools(s, client, templateStore); - src/tools/templates.ts:70-74 (registration)The export function registerTemplateTools which calls server.tool() to register delete_workflow_template.
export function registerTemplateTools( server: McpServer, client: ComfyUIClient, store: TemplateStore, ): void { - src/tools/templates.ts:22-28 (helper)Helper function validateName used by the handler to validate the template name against a regex pattern.
function validateName(name: string): void { if (!TEMPLATE_NAME_PATTERN.test(name)) { throw new Error( `Invalid template name "${name}". Must start with alphanumeric; only letters, digits, '-', '_' allowed; max 64 chars.`, ); } }