MCP cdp_heap_snapshot

Description

Capture a heap snapshot of the debugged Roku app via CDP HeapProfiler.takeHeapSnapshot.

Requires rk server mode: this tool talks to the server's owned CDP connection, not a private socket. The snapshot streams back from the device as a series of chunks written directly to a .heapsnapshot file on disk as they arrive -- this call blocks until the whole snapshot has been captured and written (can take up to two minutes on a large heap), and the response is metadata only, never the snapshot payload itself.

Optional parameters:

  • sessionId (string): Session id returned by cdp_session_create. Uses the active session when omitted.
  • output (string): Output .heapsnapshot file path (must stay within project root). Auto-generated
    under the project root when omitted.

Response:

  • filePath (string): Absolute path the snapshot was written to.
  • bytes (number): Total size of the written file.
  • nodeCount (number): Number of heap nodes in the snapshot.
  • edgeCount (number): Number of heap edges in the snapshot.

The resulting .heapsnapshot file loads directly in Chrome DevTools' Memory panel.

Notes:

  • Only one active heap snapshot capture per session is allowed. A concurrent request returns
    409 SNAPSHOT_ALREADY_ACTIVE.
  • A capture started immediately after a SNAPSHOT_TIMEOUT may come back incomplete if the device
    is still streaming stale chunks from the prior, timed-out capture.

See also

Parameters

additionalProperties: false

NameTypeRequiredValues
sessionIdstringNo
outputstringNo

sessionId

Session id returned by cdp_session_create. Uses the active session when omitted.

output

Output .heapsnapshot file path (must stay within project root when provided)


Did this page help you?