Skip to main content
Glama

clear_queue

Remove pending jobs from the ComfyUI workflow queue by clearing all items or deleting specific prompt IDs to manage processing tasks.

Instructions

Clear the queue or delete specific items.

Args: delete_ids: Optional list of prompt IDs to delete. If not provided, clears entire queue. Use this to remove pending jobs from the queue.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
delete_idsNoSpecific prompt IDs to delete

Implementation Reference

  • The core handler function for the 'clear_queue' MCP tool. It conditionally deletes specific prompt IDs or clears the entire queue by making a POST request to ComfyUI's /queue endpoint using the comfy_post helper. Logs actions via context and returns success/failure message.
    @mcp.tool() def clear_queue( delete_ids: list = Field(default=None, description="Specific prompt IDs to delete"), ctx: Context = None, ) -> str: """Clear the queue or delete specific items. Args: delete_ids: Optional list of prompt IDs to delete. If not provided, clears entire queue. Use this to remove pending jobs from the queue. """ if ctx: if delete_ids: ctx.info(f"Deleting {len(delete_ids)} items from queue") else: ctx.info("Clearing entire queue") if delete_ids: status, _ = comfy_post("/queue", {"delete": delete_ids}) else: status, _ = comfy_post("/queue", {"clear": True}) return "Queue cleared" if status == 200 else "Clear failed"
  • Part of register_all_tools(mcp): calls register_system_tools(mcp), which defines and registers the clear_queue tool (among others) using @mcp.tool() decorators.
    register_system_tools(mcp)
  • Top-level registration in the server init: calls register_all_tools(mcp), indirectly registering the clear_queue tool.
    register_all_tools(mcp)
  • High-level API helper function clear_queue that performs the same queue clearing logic as the tool handler (though not directly called by it).
    def clear_queue(delete_ids: list[str] | None = None) -> tuple[int, dict]: """Clear queue or delete specific items.""" if delete_ids: return comfy_post("/queue", {"delete": delete_ids}) return comfy_post("/queue", {"clear": True})
  • Pydantic schema definition for the tool input parameter using Field for validation and documentation.
    delete_ids: list = Field(default=None, description="Specific prompt IDs to delete"),

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/IO-AtelierTech/comfyui-mcp'

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