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"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions the tool 'interrupts' and 'cancels', implying a destructive action, but doesn't specify permissions needed, whether cancellation is reversible, or what happens to partial results. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and well-structured: a clear purpose statement, parameter explanation, and usage note in three brief lines. Every sentence adds value with no redundancy or fluff, making it easy to scan and understand.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 1 parameter with full schema coverage and no output schema, the description is moderately complete. It covers the basic purpose and parameter default behavior but lacks details on permissions, side effects, or error handling. For a destructive tool without annotations, it should provide more behavioral context to be fully adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the single parameter 'prompt_id'. The description adds marginal value by clarifying the default behavior: 'If not provided, cancels all running jobs.' This provides context beyond the schema's description of 'Specific prompt ID to cancel', but doesn't add syntax or format details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Interrupt current generation' with a specific verb ('interrupt') and resource ('current generation'). It distinguishes from siblings like 'clear_queue' by focusing on active jobs rather than queued ones. However, it doesn't explicitly contrast with all relevant siblings like 'submit_workflow' or 'run_workflow'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some usage context: 'Use this to stop a long-running generation' implies when to use it. However, it doesn't explicitly state when NOT to use it (e.g., for queued vs. running jobs) or name specific alternatives among siblings like 'clear_queue' for queued items. The guidance is helpful but incomplete.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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