cancel_current
Stop ongoing ComfyUI image generations by interrupting specific prompts or all running jobs to manage workflow execution.
Instructions
Interrupt current generation.
Args:
prompt_id: Optional specific prompt ID to cancel.
If not provided, cancels all running jobs.
Use this to stop a long-running generation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt_id | No | Specific prompt ID to cancel |
Implementation Reference
- The handler function for the 'cancel_current' tool. It sends a POST request to ComfyUI's /interrupt endpoint to cancel the current generation or a specific prompt_id. Includes inline schema via Pydantic Field and docstring. Registered via @mcp.tool() decorator.@mcp.tool() def cancel_current( prompt_id: str = Field(default=None, description="Specific prompt ID to cancel"), ctx: Context = None, ) -> str: """Interrupt current generation. Args: prompt_id: Optional specific prompt ID to cancel. If not provided, cancels all running jobs. Use this to stop a long-running generation. """ if ctx: msg = f"Cancelling prompt {prompt_id}" if prompt_id else "Cancelling all" ctx.info(msg) data = {"prompt_id": prompt_id} if prompt_id else {} status, _ = comfy_post("/interrupt", data) return "Interrupted successfully" if status == 200 else "Interrupt failed"
- src/comfy_mcp_server/tools/__init__.py:23-28 (registration)Top-level registration function that calls register_system_tools (which registers cancel_current).def register_all_tools(mcp): """Register all tools with the MCP server.""" register_system_tools(mcp) register_discovery_tools(mcp) register_workflow_tools(mcp) register_execution_tools(mcp)
- src/comfy_mcp_server/__init__.py:92-92 (registration)Call to register_all_tools(mcp), which ultimately registers the cancel_current tool.register_all_tools(mcp)