comfy_delete_workflow
Remove saved workflows from the ComfyUI library to manage your workflow collection. Requires confirmation for safety before deletion.
Instructions
Delete a saved workflow from the MCP library. Requires confirmation for safety.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| confirm | No |
Input Schema (JSON Schema)
{
"properties": {
"confirm": {
"default": false,
"type": "boolean"
},
"name": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}
Implementation Reference
- src/tools/workflows.ts:155-194 (handler)The main handler function that executes the comfy_delete_workflow tool. Validates the confirmation flag, calls the delete helper, handles errors, and formats the response.export async function handleDeleteWorkflow(input: DeleteWorkflowInput) { try { if (!input.confirm) { throw ComfyUIErrorBuilder.validationError( 'Set confirm=true to delete the workflow' ); } deleteWorkflowFromLibrary(input.name); return { content: [{ type: "text", text: JSON.stringify({ name: input.name, deleted: true, message: `Workflow "${input.name}" deleted successfully` }, null, 2) }] }; } catch (error: any) { if (error.message.includes('not found')) { return { content: [{ type: "text", text: JSON.stringify(ComfyUIErrorBuilder.fileNotFound(input.name), null, 2) }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify(ComfyUIErrorBuilder.executionError(error.message), null, 2) }], isError: true }; } }
- src/types/tools.ts:104-108 (schema)Zod schema for input validation: requires workflow name and optional confirmation boolean (defaults to false).// Delete Workflow Tool export const DeleteWorkflowSchema = z.object({ name: z.string(), confirm: z.boolean().optional().default(false) });
- src/server.ts:107-111 (registration)Tool registration in the listTools handler, providing name, description, and input schema.{ name: 'comfy_delete_workflow', description: 'Delete a saved workflow from the MCP library. Requires confirmation for safety.', inputSchema: zodToJsonSchema(DeleteWorkflowSchema) as any, },
- src/server.ts:173-174 (registration)Switch case in callTool handler that routes to the delete workflow handler function.case 'comfy_delete_workflow': return await handleDeleteWorkflow(args as any);
- src/utils/filesystem.ts:250-260 (helper)Supporting utility that constructs the workflow file path and deletes it using Node.js fs.unlinkSync.export function deleteWorkflowFromLibrary(name: string): void { const config = getConfig(); const libraryPath = getFullPath(config.paths.workflow_library); const filePath = join(libraryPath, `${name}.json`); if (!existsSync(filePath)) { throw new Error(`Workflow not found: ${name}`); } unlinkSync(filePath); }