Skip to content

CLI skill's get_heapsnapshot_class_nodes example passes a class name where a numeric class id is required #2918

Closed

Description

@coygeek

Description of the bug

The Memory Debugging examples in skills/chrome-devtools-cli/SKILL.md include chrome-devtools get_heapsnapshot_class_nodes "./snap.heapsnapshot" "Array" # Inspect class instances. The command's second positional is id, a required number described as "The ID for the class, obtained from details", so the class name "Array" is rejected with Input validation error: Invalid arguments for tool get_heapsnapshot_class_nodes: id: Invalid input: expected number, received null. An agent that copies the example gets a validation error instead of class instances. The example line is identical in the 1.10.1 npm package and on main at b2f522c (line 109 in both), and has been in this form since it was added in #2569 (1.8.0), when the command already took a numeric id.

Actual behavior

In both builds, step 5 printed Input validation error: Invalid arguments for tool get_heapsnapshot_class_nodes: id: Invalid input: expected number, received null and exited 0. Step 6 printed chrome-devtools get_heapsnapshot_class_nodes <filePath> <id> [--filterName] [--objectId] [--pageIdx] [--pageSize] with id The ID for the class, obtained from details. [number] [required]. The step 7 control printed ## Heap Snapshot Data followed by nodeId,nodeName,type,distance,selfSize,retainedSize rows (for example 56487,,array,4,4.1 kB,41.3 kB on 1.10.1).

Incidental observation from the same runs: when get_heapsnapshot_class_nodes was called with a numeric id in a freshly started daemon before any get_heapsnapshot_details call on that file, both builds printed Error: Class with ID 18 not found in heap snapshot; after get_heapsnapshot_details ran in the same daemon, the same id returned nodes. A working example therefore depends on the details call coming first, which the parameter description ("obtained from details") already implies.

Reproduction

Executed on macOS with Node v24.21.0 and Google Chrome 154.0.8037.93 against the published chrome-devtools-mcp@1.10.1 package and a local build of main, with usage statistics and update checks disabled (CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS=1) and XDG_RUNTIME_DIR pointed at a scratch directory so the CLI daemon socket was private to the test. Scratch paths below are shortened to /tmp/x.

  1. npm i --prefix /tmp/x chrome-devtools-mcp@1.10.1 and run the following from /tmp/x/node_modules/.bin.
  2. chrome-devtools start --no-usage-statistics --no-performance-crux (headless and isolated by CLI default).
  3. chrome-devtools navigate_page 1 --url "http://localhost:<port>/" (any reachable page; I used a minimal page served on a loopback port).
  4. chrome-devtools take_heapsnapshot 1 /tmp/x/snap.heapsnapshot.
  5. Run the skill line with only the file path adapted: chrome-devtools get_heapsnapshot_class_nodes /tmp/x/snap.heapsnapshot "Array".
  6. chrome-devtools get_heapsnapshot_class_nodes --help.
  7. Control, in the same daemon session: chrome-devtools get_heapsnapshot_details /tmp/x/snap.heapsnapshot, take a value from its id column (for example the 3,(array),... row), then chrome-devtools get_heapsnapshot_class_nodes /tmp/x/snap.heapsnapshot 3.
  8. chrome-devtools stop.

I repeated the same steps with node build/src/bin/chrome-devtools.js from the main build.

Expectation

The skill's example should be a valid invocation that lists the instances of a class, as its comment ("Inspect class instances") says. The skill itself says required arguments are passed positionally (skills/chrome-devtools-cli/SKILL.md:35). The generated CLI definition declares get_heapsnapshot_class_nodes with filePath (string, required) and id (number, required, "The ID for the class, obtained from details.") in src/config/cli-options.ts (lines 444-496 at tag chrome-devtools-mcp-v1.10.1, lines 499-551 on main), and the tool schema in src/tools/memory.ts is id: zod.number().

Chrome DevTools MCP version

1.10.1 (npm) and main b2f522c (local build)

Chrome version

154.0.8037.93 (stable, headless, isolated)

Node version

v24.21.0

Operating system

macOS

Evidence

  • Expected source: src/config/cli-options.ts (get_heapsnapshot_class_nodes, lines 444-496 at tag chrome-devtools-mcp-v1.10.1, lines 499-551 on main), src/tools/memory.ts (getHeapSnapshotClassNodes schema), the get_heapsnapshot_class_nodes --help output in both builds, and skills/chrome-devtools-cli/SKILL.md:35.
  • Failure source: skills/chrome-devtools-cli/SKILL.md:109 (identical in the 1.10.1 npm package and on main) and the CLI output quoted under Actual behavior.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Fix check

Failing now: running the skill's get_heapsnapshot_class_nodes example (file path adapted) prints the id: Invalid input: expected number, received null validation error. Restored: the skill's class-instance example, followed as written, including any step it gives for obtaining the id, returns the ## Heap Snapshot Data node listing, as the step 7 control does. Class ids are assigned when get_heapsnapshot_details runs, so a fixed number alone is not expected to return data. Control: a non-numeric id keeps being rejected unless the command's contract is deliberately changed to accept class names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmeddocumentationp3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions