Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameYes
confirmNo

Implementation Reference

  • 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
        };
      }
    }
  • 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,
    },
  • 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);
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Nikolaibibo/claude-comfyui-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server