comfy_clear_queue
Clear all pending items from the ComfyUI queue without affecting currently running generations. Requires confirmation to remove queued tasks.
Instructions
Clear all pending items from the queue (does not affect currently running generation). Requires confirmation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No |
Implementation Reference
- src/tools/queue.ts:105-148 (handler)The primary handler function for the 'comfy_clear_queue' MCP tool. Validates confirmation, clears the ComfyUI queue via the client, and returns success/error responses.export async function handleClearQueue(input: ClearQueueInput) { try { if (!input.confirm) { throw ComfyUIErrorBuilder.validationError( 'Set confirm=true to clear the queue' ); } const client = getComfyUIClient(); const queue = await client.getQueue(); const count = queue.queue_pending.length; await client.clearQueue(); return { content: [{ type: "text", text: JSON.stringify({ cleared: true, count, message: `Cleared ${count} pending items from queue` }, null, 2) }] }; } catch (error: any) { if (error.error) { return { content: [{ type: "text", text: JSON.stringify(error, null, 2) }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify(ComfyUIErrorBuilder.executionError(error.message), null, 2) }], isError: true }; } }
- src/types/tools.ts:117-119 (schema)Zod schema defining the input for 'comfy_clear_queue': a boolean confirmation flag.export const ClearQueueSchema = z.object({ confirm: z.boolean().optional().default(false) });
- src/server.ts:126-129 (registration)Tool registration in the MCP server's ListTools response, providing name, description, and input schema.name: 'comfy_clear_queue', description: 'Clear all pending items from the queue (does not affect currently running generation). Requires confirmation.', inputSchema: zodToJsonSchema(ClearQueueSchema) as any, },
- src/server.ts:182-183 (registration)Dispatch routing in the CallToolRequest handler that invokes the handleClearQueue function for 'comfy_clear_queue' calls.case 'comfy_clear_queue': return await handleClearQueue(args as any);