Skip to main content
Glama

emergency_cleanup

Frees GPU memory by unloading ComfyUI models, with an option to restart ComfyUI when memory remains constrained or CUDA out-of-memory errors block image generation.

Instructions

Recover GPU memory by unloading ComfyUI's models.

ComfyUI is a separate process and holds the models, so torch.cuda in THIS process can never free them. POST /free on ComfyUI is the only real lever; nvidia-smi measures the result.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "emergency_cleanup"
  }
}

Input Schema

NameRequiredDescriptionDefault
restart_comfyuiNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.2/5.0
Behavior3/5

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

With no annotations, the description carries the full burden and does contribute real insight: it explains why in-process torch.cuda cannot free the memory and what the actual lever is. It omits the important side effects an agent needs — that loaded models are dropped and subsequent generations pay a reload cost — and says nothing about whether the operation can fail if ComfyUI is down or not running.

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

Conciseness4/5

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

Three short sentences with the purpose front-loaded and no filler; the explanation of why the obvious approach fails earns its place. The closing clause about nvidia-smi is slightly clipped and telegraphic but still informative.

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?

The tool is simple and an output schema exists, so return values need no explanation. Still, the undocumented restart parameter and the absence of any routing guidance against restart/stop siblings leave the agent with gaps for a tool whose name signals an emergency, high-stakes operation.

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

Parameters2/5

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

Schema description coverage is 0% for the single parameter restart_comfyui, and the description never mentions it. A boolean that restarts a whole process is behaviorally significant and is left entirely to the bare property name and default, so the description fails to compensate for the coverage gap.

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?

States a specific verb and resource: 'Recover GPU memory by unloading ComfyUI's models.' The added mechanism note (POST /free, separate process) makes the action unambiguous. It does not name a sibling such as get_vram_usage or stop_comfyui, so it falls short of full differentiation.

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?

'POST /free on ComfyUI is the only real lever' implies this is the tool to use when VRAM must actually be reclaimed, which is useful implied guidance. However, there is no explicit when-to-use/when-not-to-use, no comparison with stop_comfyui or restart, and no guidance on when the restart_comfyui path is warranted over the plain unload.

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