Skip to main content
Glama

cancel_current

Stop long-running image generations in ComfyUI workflows by interrupting current processes or canceling specific prompt IDs.

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
NameRequiredDescriptionDefault
prompt_idNoSpecific prompt ID to cancel

Implementation Reference

  • The handler function implementing the 'cancel_current' tool logic. It optionally takes a prompt_id and sends a POST request to ComfyUI's /interrupt endpoint to cancel running jobs. Includes inline schema via Pydantic Field and is 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"

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