comfy_delete_workflow
Remove saved workflows from the ComfyUI MCP Server library with confirmation prompts for safety.
Instructions
Delete a saved workflow from the MCP library. Requires confirmation for safety.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| confirm | No |
Implementation Reference
- src/tools/workflows.ts:155-194 (handler)The handler function for the 'comfy_delete_workflow' tool. Validates the confirmation flag, calls the filesystem delete helper, and returns a formatted MCP response with success or error details.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 defining the input parameters for the comfy_delete_workflow tool: workflow name (required) and confirmation flag (optional, 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)Registration of the 'comfy_delete_workflow' tool in the MCP server, including name, description, and input schema reference.{ name: 'comfy_delete_workflow', description: 'Delete a saved workflow from the MCP library. Requires confirmation for safety.', inputSchema: zodToJsonSchema(DeleteWorkflowSchema) as any, },
- src/utils/filesystem.ts:250-260 (helper)Supporting utility function that performs the actual file deletion of the workflow JSON from the configured library directory.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); }