Skip to main content
Glama

heap_snapshot

Destructive

Capture a JavaScript heap snapshot after garbage collection to summarize memory use, detached DOM nodes, and top classes; compare with an earlier snapshot to spot leaks.

Instructions

Take a JS heap snapshot of the tab (after a garbage collection) and summarize it: object count, total size, detached DOM nodes, the classes that take most memory. With compare_to (an earlier snapshot file): which classes grew, to find a leak — snapshot, repeat the suspect action a few times, snapshot again. The .heapsnapshot file opens in DevTools > Memory. Works only in launch mode (chrome-bridge --launch [--headless]): it needs the DevTools port of the dedicated browser, which the extension in your own Chrome cannot provide: Chrome refuses the HeapProfiler domain to extensions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topNoClasses listed
tab_idNoTarget tab; omitted = last tab navigated in this session, else the active one
save_toNoAbsolute path: write the .heapsnapshot there and return the path instead of the content
compare_toNoAbsolute path of an earlier .heapsnapshot to diff against

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.28.0

TDQS

A4.6/5.0
Behavior4/5

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

Adds substantial context beyond the annotations: a forced garbage collection, the launch-mode requirement and its rationale, the side artifact (.heapsnapshot opens in DevTools > Memory), and the file-vs-content behavior when saving. It does not explain why the tool is flagged destructiveHint=true (e.g. page pause / GC-induced disruption), so one behavioral thread is left dangling.

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?

Front-loads the core action and its outputs, then layers on the diff workflow and the launch-mode constraint in a logical order. It is dense and slightly run-on with chained colons, but no sentence is filler.

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

Completeness5/5

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

No output schema exists, yet the description tells the agent exactly what a call yields (the summarized metrics or a saved file path) and what happens in compare mode. Combined with the capability constraint, an agent has everything needed to invoke it correctly.

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

Parameters4/5

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

Schema coverage is already 100% (baseline 3), but the description adds real meaning: compare_to is framed as an earlier snapshot file used to identify grown classes, and save_to's path-vs-content tradeoff is implied by the return-format discussion. top and tab_id semantics are left entirely to the schema.

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

Purpose5/5

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

States a specific verb and resource (take a JS heap snapshot of the tab) and enumerates what the summary contains: object count, total size, detached DOM nodes, top memory classes. It is clearly distinguishable from sibling diagnostics like perf_trace or lighthouse.

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

Usage Guidelines5/5

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

Gives the concrete leak-hunting workflow (snapshot, repeat the suspect action a few times, snapshot again, then diff with compare_to) and an explicit when-not/precondition: it only works in launch mode with chrome-bridge --launch, because Chrome refuses the HeapProfiler domain to extensions.

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