comfy_clear_queue
Remove all pending items from the ComfyUI generation queue while preserving currently running tasks. Requires user confirmation to prevent accidental deletions.
Instructions
Clear all pending items from the queue (does not affect currently running generation). Requires confirmation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No |
Input Schema (JSON Schema)
{
"properties": {
"confirm": {
"default": false,
"type": "boolean"
}
},
"type": "object"
}
Implementation Reference
- src/tools/queue.ts:105-148 (handler)The main handler function that executes the logic for clearing the ComfyUI generation queue after user confirmation. It interacts with the ComfyUI client to get the queue, clear it, and returns a success message with the count of cleared items.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 the comfy_clear_queue tool, requiring a confirmation boolean.export const ClearQueueSchema = z.object({ confirm: z.boolean().optional().default(false) });
- src/server.ts:125-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 case in the CallToolRequestHandler that routes calls to the handleClearQueue function.case 'comfy_clear_queue': return await handleClearQueue(args as any);