Chrome DevTools for coding agents
chore(memory): update names and exposed information (#2079)
Nikolay Vitkov32dc50d59bdb
diff --git a/README.md b/README.mdindex 50be708c..80647b2c 100644--- a/README.md+++ b/README.md@@ -515,11 +515,11 @@ If you run into any issues, checkout our [troubleshooting guide](./docs/troubles- [`screencast_start`](docs/tool-reference.md#screencast_start)- [`screencast_stop`](docs/tool-reference.md#screencast_stop)- **Memory** (5 tools)- - [`take_memory_snapshot`](docs/tool-reference.md#take_memory_snapshot)- - [`get_memory_snapshot_details`](docs/tool-reference.md#get_memory_snapshot_details)- - [`get_node_retainers`](docs/tool-reference.md#get_node_retainers)- - [`get_nodes_by_class`](docs/tool-reference.md#get_nodes_by_class)- - [`load_memory_snapshot`](docs/tool-reference.md#load_memory_snapshot)+ - [`take_heapsnapshot`](docs/tool-reference.md#take_heapsnapshot)+ - [`get_heapsnapshot_class_nodes`](docs/tool-reference.md#get_heapsnapshot_class_nodes)+ - [`get_heapsnapshot_details`](docs/tool-reference.md#get_heapsnapshot_details)+ - [`get_heapsnapshot_retainers`](docs/tool-reference.md#get_heapsnapshot_retainers)+ - [`get_heapsnapshot_summary`](docs/tool-reference.md#get_heapsnapshot_summary)- **Extensions** (5 tools)- [`install_extension`](docs/tool-reference.md#install_extension)- [`list_extensions`](docs/tool-reference.md#list_extensions)diff --git a/docs/tool-reference.md b/docs/tool-reference.mdindex 79596def..6e8a2ba8 100644--- a/docs/tool-reference.md+++ b/docs/tool-reference.md@@ -40,11 +40,11 @@- [`screencast_start`](#screencast_start)- [`screencast_stop`](#screencast_stop)- **[Memory](#memory)** (5 tools)- - [`take_memory_snapshot`](#take_memory_snapshot)- - [`get_memory_snapshot_details`](#get_memory_snapshot_details)- - [`get_node_retainers`](#get_node_retainers)- - [`get_nodes_by_class`](#get_nodes_by_class)- - [`load_memory_snapshot`](#load_memory_snapshot)+ - [`take_heapsnapshot`](#take_heapsnapshot)+ - [`get_heapsnapshot_class_nodes`](#get_heapsnapshot_class_nodes)+ - [`get_heapsnapshot_details`](#get_heapsnapshot_details)+ - [`get_heapsnapshot_retainers`](#get_heapsnapshot_retainers)+ - [`get_heapsnapshot_summary`](#get_heapsnapshot_summary)- **[Extensions](#extensions)** (5 tools)- [`install_extension`](#install_extension)- [`list_extensions`](#list_extensions)@@ -443,7 +443,7 @@ in the DevTools Elements panel (if any).## Memory-### `take_memory_snapshot`+### `take_heapsnapshot`**Description:** Capture a heap snapshot of the currently selected page. Use to analyze the memory distribution of JavaScript objects and debug memory leaks.@@ -453,45 +453,45 @@ in the DevTools Elements panel (if any).----### `get_memory_snapshot_details`+### `get_heapsnapshot_class_nodes`-**Description:** Loads a memory heapsnapshot and returns all available information including statistics, static data, and aggregated node information. Supports pagination for aggregates. (requires flag: --experimentalMemory=true)+**Description:** Loads a memory heapsnapshot and returns instances of a specific class with their IDs. (requires flag: --experimentalMemory=true)**Parameters:**- **filePath** (string) **(required)**: A path to a .heapsnapshot file to read.-- **pageIdx** (number) _(optional)_: The page index for pagination of aggregates.-- **pageSize** (number) _(optional)_: The page size for pagination of aggregates.+- **id** (number) **(required)**: The ID for the class, obtained from details.+- **pageIdx** (number) _(optional)_: The page index for pagination.+- **pageSize** (number) _(optional)_: The page size for pagination.----### `get_node_retainers`+### `get_heapsnapshot_details`-**Description:** Loads a memory heapsnapshot and returns retainers for a specific node ID. (requires flag: --experimentalMemory=true)+**Description:** Loads a memory heapsnapshot and returns all available information including statistics, static data, and aggregated node information. Supports pagination for aggregates. (requires flag: --experimentalMemory=true)**Parameters:**- **filePath** (string) **(required)**: A path to a .heapsnapshot file to read.-- **nodeId** (number) **(required)**: The stable node ID to get retainers for.-- **pageIdx** (number) _(optional)_: The page index for pagination.-- **pageSize** (number) _(optional)_: The page size for pagination.+- **pageIdx** (number) _(optional)_: The page index for pagination of aggregates.+- **pageSize** (number) _(optional)_: The page size for pagination of aggregates.----### `get_nodes_by_class`+### `get_heapsnapshot_retainers`-**Description:** Loads a memory heapsnapshot and returns instances of a specific class with their stable IDs. (requires flag: --experimentalMemory=true)+**Description:** Loads a memory heapsnapshot and returns retainers for a specific node ID. (requires flag: --experimentalMemory=true)**Parameters:**- **filePath** (string) **(required)**: A path to a .heapsnapshot file to read.-- **uid** (number) **(required)**: The unique UID for the class, obtained from aggregates listing.+- **nodeId** (number) **(required)**: The node ID to get retainers for.- **pageIdx** (number) _(optional)_: The page index for pagination.- **pageSize** (number) _(optional)_: The page size for pagination.----### `load_memory_snapshot`+### `get_heapsnapshot_summary`**Description:** Loads a memory heapsnapshot and returns snapshot summary stats. (requires flag: --experimentalMemory=true)diff --git a/src/HeapSnapshotManager.ts b/src/HeapSnapshotManager.tsindex ff28d71c..c84b04ff 100644--- a/src/HeapSnapshotManager.ts+++ b/src/HeapSnapshotManager.ts@@ -15,7 +15,7 @@ import {type WithSymbolId,} from './utils/id.js';-export type AggregatedInfoWithUid =+export type AggregatedInfoWithId =WithSymbolId<DevTools.HeapSnapshotModel.HeapSnapshotModel.AggregatedInfo>;export class HeapSnapshotManager {@@ -25,8 +25,8 @@ export class HeapSnapshotManager {snapshot: DevTools.HeapSnapshotModel.HeapSnapshotProxy.HeapSnapshotProxy;worker: DevTools.HeapSnapshotModel.HeapSnapshotProxy.HeapSnapshotWorkerProxy;// TODO: use a multimap- uidToClassKey: Map<number, string>;- classKeyToUid: Map<string, number>;+ idToClassKey: Map<number, string>;+ classKeyToId: Map<string, number>;idGenerator: () => number;}>();@@ -44,8 +44,8 @@ export class HeapSnapshotManager {this.#snapshots.set(absolutePath, {snapshot,worker,- uidToClassKey: new Map<number, string>(),- classKeyToUid: new Map<string, number>(),+ idToClassKey: new Map<number, string>(),+ classKeyToId: new Map<string, number>(),idGenerator: createIdGenerator(),});@@ -54,18 +54,18 @@ export class HeapSnapshotManager {async getAggregates(filePath: string,- ): Promise<Record<string, AggregatedInfoWithUid>> {+ ): Promise<Record<string, AggregatedInfoWithId>> {const snapshot = await this.getSnapshot(filePath);const filter =new DevTools.HeapSnapshotModel.HeapSnapshotModel.NodeFilter();- const aggregates: Record<string, AggregatedInfoWithUid> =+ const aggregates: Record<string, AggregatedInfoWithId> =await snapshot.aggregatesWithFilter(filter);for (const key of Object.keys(aggregates)) {- const uid = await this.getOrCreateUidForClassKey(filePath, key);+ const id = await this.getOrCreateIdForClassKey(filePath, key);const aggregate = aggregates[key];if (aggregate) {- aggregate[stableIdSymbol] = uid;+ aggregate[stableIdSymbol] = id;}}@@ -86,30 +86,30 @@ export class HeapSnapshotManager {return snapshot.staticData;}- async getOrCreateUidForClassKey(+ async getOrCreateIdForClassKey(filePath: string,classKey: string,): Promise<number> {const cached = this.#getCachedSnapshot(filePath);- let uid = cached.classKeyToUid.get(classKey);- if (!uid) {- uid = cached.idGenerator();- cached.classKeyToUid.set(classKey, uid);- cached.uidToClassKey.set(uid, classKey);+ let id = cached.classKeyToId.get(classKey);+ if (!id) {+ id = cached.idGenerator();+ cached.classKeyToId.set(classKey, id);+ cached.idToClassKey.set(id, classKey);}- return uid;+ return id;}- async getNodesByUid(+ async getNodesById(filePath: string,- uid: number,+ id: number,): Promise<DevTools.HeapSnapshotModel.HeapSnapshotModel.ItemsRange> {const snapshot = await this.getSnapshot(filePath);const filter =new DevTools.HeapSnapshotModel.HeapSnapshotModel.NodeFilter();- const className = await this.resolveClassKeyFromUid(filePath, uid);+ const className = await this.resolveClassKeyFromId(filePath, id);if (!className) {- throw new Error(`Class with UID ${uid} not found in heap snapshot`);+ throw new Error(`Class with ID ${id} not found in heap snapshot`);}const provider = snapshot.createNodesProviderForClass(className, filter);@@ -159,12 +159,12 @@ export class HeapSnapshotManager {return cached;}- async resolveClassKeyFromUid(+ async resolveClassKeyFromId(filePath: string,- uid: number,+ id: number,): Promise<string | undefined> {const cached = this.#getCachedSnapshot(filePath);- return cached.uidToClassKey.get(uid);+ return cached.idToClassKey.get(id);}async #loadSnapshot(absolutePath: string): Promise<{diff --git a/src/McpContext.ts b/src/McpContext.tsindex f3c39eaf..88fa344c 100644--- a/src/McpContext.ts+++ b/src/McpContext.ts@@ -12,7 +12,7 @@ import {fileURLToPath, pathToFileURL} from 'node:url';import type {TargetUniverse} from './DevtoolsUtils.js';import {UniverseManager} from './DevtoolsUtils.js';import {HeapSnapshotManager} from './HeapSnapshotManager.js';-import type {AggregatedInfoWithUid} from './HeapSnapshotManager.js';+import type {AggregatedInfoWithId} from './HeapSnapshotManager.js';import {McpPage} from './McpPage.js';import {NetworkCollector,@@ -804,7 +804,7 @@ export class McpContext implements Context {async getHeapSnapshotAggregates(filePath: string,- ): Promise<Record<string, AggregatedInfoWithUid>> {+ ): Promise<Record<string, AggregatedInfoWithId>> {this.validatePath(filePath);return await this.#heapSnapshotManager.getAggregates(filePath);}@@ -823,12 +823,12 @@ export class McpContext implements Context {return await this.#heapSnapshotManager.getStaticData(filePath);}- async getHeapSnapshotNodesByUid(+ async getHeapSnapshotNodesById(filePath: string,- uid: number,+ id: number,): Promise<DevTools.HeapSnapshotModel.HeapSnapshotModel.ItemsRange> {this.validatePath(filePath);- return await this.#heapSnapshotManager.getNodesByUid(filePath, uid);+ return await this.#heapSnapshotManager.getNodesById(filePath, id);}async getHeapSnapshotRetainers(diff --git a/src/bin/chrome-devtools-cli-options.ts b/src/bin/chrome-devtools-cli-options.tsindex 55f4af01..221ad3eb 100644--- a/src/bin/chrome-devtools-cli-options.ts+++ b/src/bin/chrome-devtools-cli-options.ts@@ -284,9 +284,9 @@ export const commands: Commands = {},},},- get_memory_snapshot_details: {+ get_heapsnapshot_class_nodes: {description:- 'Loads a memory heapsnapshot and returns all available information including statistics, static data, and aggregated node information. Supports pagination for aggregates. (requires flag: --experimentalMemory=true)',+ 'Loads a memory heapsnapshot and returns instances of a specific class with their IDs. (requires flag: --experimentalMemory=true)',category: 'Memory',args: {filePath: {@@ -295,49 +295,52 @@ export const commands: Commands = {description: 'A path to a .heapsnapshot file to read.',required: true,},+ id: {+ name: 'id',+ type: 'number',+ description: 'The ID for the class, obtained from details.',+ required: true,+ },pageIdx: {name: 'pageIdx',type: 'number',- description: 'The page index for pagination of aggregates.',+ description: 'The page index for pagination.',required: false,},pageSize: {name: 'pageSize',type: 'number',- description: 'The page size for pagination of aggregates.',+ description: 'The page size for pagination.',required: false,},},},- get_network_request: {+ get_heapsnapshot_details: {description:- 'Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.',- category: 'Network',+ 'Loads a memory heapsnapshot and returns all available information including statistics, static data, and aggregated node information. Supports pagination for aggregates. (requires flag: --experimentalMemory=true)',+ category: 'Memory',args: {- reqid: {- name: 'reqid',- type: 'number',- description:- 'The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.',- required: false,- },- requestFilePath: {- name: 'requestFilePath',+ filePath: {+ name: 'filePath',type: 'string',- description:- 'The absolute or relative path to a .network-request file to save the request body to. If omitted, the body is returned inline.',+ description: 'A path to a .heapsnapshot file to read.',+ required: true,+ },+ pageIdx: {+ name: 'pageIdx',+ type: 'number',+ description: 'The page index for pagination of aggregates.',required: false,},- responseFilePath: {- name: 'responseFilePath',- type: 'string',- description:- 'The absolute or relative path to a .network-response file to save the response body to. If omitted, the body is returned inline.',+ pageSize: {+ name: 'pageSize',+ type: 'number',+ description: 'The page size for pagination of aggregates.',required: false,},},},- get_node_retainers: {+ get_heapsnapshot_retainers: {description:'Loads a memory heapsnapshot and returns retainers for a specific node ID. (requires flag: --experimentalMemory=true)',category: 'Memory',@@ -351,7 +354,7 @@ export const commands: Commands = {nodeId: {name: 'nodeId',type: 'number',- description: 'The stable node ID to get retainers for.',+ description: 'The node ID to get retainers for.',required: true,},pageIdx: {@@ -368,9 +371,9 @@ export const commands: Commands = {},},},- get_nodes_by_class: {+ get_heapsnapshot_summary: {description:- 'Loads a memory heapsnapshot and returns instances of a specific class with their stable IDs. (requires flag: --experimentalMemory=true)',+ 'Loads a memory heapsnapshot and returns snapshot summary stats. (requires flag: --experimentalMemory=true)',category: 'Memory',args: {filePath: {@@ -379,23 +382,32 @@ export const commands: Commands = {description: 'A path to a .heapsnapshot file to read.',required: true,},- uid: {- name: 'uid',+ },+ },+ get_network_request: {+ description:+ 'Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.',+ category: 'Network',+ args: {+ reqid: {+ name: 'reqid',type: 'number',description:- 'The unique UID for the class, obtained from aggregates listing.',- required: true,+ 'The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.',+ required: false,},- pageIdx: {- name: 'pageIdx',- type: 'number',- description: 'The page index for pagination.',+ requestFilePath: {+ name: 'requestFilePath',+ type: 'string',+ description:+ 'The absolute or relative path to a .network-request file to save the request body to. If omitted, the body is returned inline.',required: false,},- pageSize: {- name: 'pageSize',- type: 'number',- description: 'The page size for pagination.',+ responseFilePath: {+ name: 'responseFilePath',+ type: 'string',+ description:+ 'The absolute or relative path to a .network-response file to save the response body to. If omitted, the body is returned inline.',required: false,},},@@ -578,19 +590,6 @@ export const commands: Commands = {category: 'WebMCP',args: {},},- load_memory_snapshot: {- description:- 'Loads a memory heapsnapshot and returns snapshot summary stats. (requires flag: --experimentalMemory=true)',- category: 'Memory',- args: {- filePath: {- name: 'filePath',- type: 'string',- description: 'A path to a .heapsnapshot file to read.',- required: true,- },- },- },navigate_page: {description:'Go to a URL, or back, forward, or reload. Use project URL if not specified otherwise.',@@ -831,7 +830,7 @@ export const commands: Commands = {},},},- take_memory_snapshot: {+ take_heapsnapshot: {description:'Capture a heap snapshot of the currently selected page. Use to analyze the memory distribution of JavaScript objects and debug memory leaks.',category: 'Memory',diff --git a/src/formatters/HeapSnapshotFormatter.ts b/src/formatters/HeapSnapshotFormatter.tsindex bb5f8b0f..e5f0a770 100644--- a/src/formatters/HeapSnapshotFormatter.ts+++ b/src/formatters/HeapSnapshotFormatter.ts@@ -4,13 +4,13 @@* SPDX-License-Identifier: Apache-2.0*/-import type {AggregatedInfoWithUid} from '../HeapSnapshotManager.js';+import type {AggregatedInfoWithId} from '../HeapSnapshotManager.js';import {DevTools} from '../third_party/index.js';import {stableIdSymbol} from '../utils/id.js';export interface FormattedSnapshotEntry {className: string;- classUid?: number;+ id?: number;count: number;selfSize: string;retainedSize: string;@@ -41,9 +41,9 @@ export function isEdgeLike(}export class HeapSnapshotFormatter {- #aggregates: Record<string, AggregatedInfoWithUid>;+ #aggregates: Record<string, AggregatedInfoWithId>;- constructor(aggregates: Record<string, AggregatedInfoWithUid>) {+ constructor(aggregates: Record<string, AggregatedInfoWithId>) {this.#aggregates = aggregates;}@@ -58,9 +58,9 @@ export class HeapSnapshotFormatter {if (items.length > 0) {const firstItem = items[0];if (isNodeLike(firstItem)) {- lines.push('id,name,type,distance,selfSize,retainedSize');+ lines.push('nodeId,nodeName,type,distance,selfSize,retainedSize');} else if (isEdgeLike(firstItem)) {- lines.push('edgeIndex,edgeName,edgeType,targetNodeId,targetNodeName');+ lines.push('name,type,nodeId,nodeName');}}@@ -71,7 +71,7 @@ export class HeapSnapshotFormatter {);} else if (isEdgeLike(item)) {lines.push(- `${item.edgeIndex},${item.name},${item.type},${item.node.id},${item.node.name}`,+ `${item.name},${item.type},${item.node.id},${item.node.name}`,);}}@@ -79,19 +79,19 @@ export class HeapSnapshotFormatter {return lines.join('\n');}- #getSortedAggregates(): AggregatedInfoWithUid[] {+ #getSortedAggregates(): AggregatedInfoWithId[] {return Object.values(this.#aggregates).sort((a, b) => b.maxRet - a.maxRet);}toString(): string {const sorted = this.#getSortedAggregates();const lines: string[] = [];- lines.push('uid,className,count,selfSize,maxRetainedSize');+ lines.push('id,name,count,selfSize,maxRetainedSize');for (const info of sorted) {- const uid = info[stableIdSymbol] ?? '';+ const id = info[stableIdSymbol] ?? '';lines.push(- `${uid},${info.name},${info.count},${DevTools.I18n.ByteUtilities.formatBytesToKb(info.self)},${DevTools.I18n.ByteUtilities.formatBytesToKb(info.maxRet)}`,+ `${id},${info.name},${info.count},${DevTools.I18n.ByteUtilities.formatBytesToKb(info.self)},${DevTools.I18n.ByteUtilities.formatBytesToKb(info.maxRet)}`,);}@@ -101,7 +101,7 @@ export class HeapSnapshotFormatter {toJSON(): FormattedSnapshotEntry[] {const sorted = this.#getSortedAggregates();return sorted.map(info => ({- uid: info[stableIdSymbol],+ id: info[stableIdSymbol],className: info.name,count: info.count,selfSize: DevTools.I18n.ByteUtilities.formatBytesToKb(info.self),diff --git a/src/telemetry/tool_call_metrics.json b/src/telemetry/tool_call_metrics.jsonindex fa6c3eeb..9453d60f 100644--- a/src/telemetry/tool_call_metrics.json+++ b/src/telemetry/tool_call_metrics.json@@ -462,7 +462,8 @@"name": "file_path_length","argType": "number"}- ]+ ],+ "isDeprecated": true},{"name": "take_screenshot",@@ -579,7 +580,8 @@"name": "file_path_length","argType": "number"}- ]+ ],+ "isDeprecated": true},{"name": "get_memory_snapshot_details",@@ -596,7 +598,8 @@"name": "page_size","argType": "number"}- ]+ ],+ "isDeprecated": true},{"name": "get_nodes_by_class",@@ -613,7 +616,8 @@"name": "page_size","argType": "number"}- ]+ ],+ "isDeprecated": true},{"name": "execute3p_developer_tool",@@ -651,6 +655,84 @@"name": "page_size","argType": "number"}+ ],+ "isDeprecated": true+ },+ {+ "name": "get_heapsnapshot_class_nodes",+ "args": [+ {+ "name": "file_path_length",+ "argType": "number"+ },+ {+ "name": "page_idx",+ "argType": "number"+ },+ {+ "name": "page_size",+ "argType": "number"+ },+ {+ "name": "id",+ "argType": "number"+ }+ ]+ },+ {+ "name": "get_heapsnapshot_details",+ "args": [+ {+ "name": "file_path_length",+ "argType": "number"+ },+ {+ "name": "page_idx",+ "argType": "number"+ },+ {+ "name": "page_size",+ "argType": "number"+ }+ ]+ },+ {+ "name": "get_heapsnapshot_retainers",+ "args": [+ {+ "name": "file_path_length",+ "argType": "number"+ },+ {+ "name": "node_id",+ "argType": "number"+ },+ {+ "name": "page_idx",+ "argType": "number"+ },+ {+ "name": "page_size",+ "argType": "number"+ }+ ]+ },+ {+ "name": "get_heapsnapshot_summary",+ "args": [+ {+ "name": "file_path_length",+ "argType": "number"+ }+ ]+ },+ {+ "name": "take_heapsnapshot",+ "args": [+ {+ "name": "file_path_length",+ "argType": "number"+ }]}]diff --git a/src/tools/ToolDefinition.ts b/src/tools/ToolDefinition.tsindex 66b6c353..37701bee 100644--- a/src/tools/ToolDefinition.ts+++ b/src/tools/ToolDefinition.ts@@ -5,7 +5,7 @@*/import type {ParsedArguments} from '../bin/chrome-devtools-mcp-cli-options.js';-import type {AggregatedInfoWithUid} from '../HeapSnapshotManager.js';+import type {AggregatedInfoWithId} from '../HeapSnapshotManager.js';import type {McpPage} from '../McpPage.js';import {zod} from '../third_party/index.js';import type {@@ -235,16 +235,16 @@ export type Context = Readonly<{): string | undefined;getHeapSnapshotAggregates(filePath: string,- ): Promise<Record<string, AggregatedInfoWithUid>>;+ ): Promise<Record<string, AggregatedInfoWithId>>;getHeapSnapshotStats(filePath: string,): Promise<DevTools.HeapSnapshotModel.HeapSnapshotModel.Statistics>;getHeapSnapshotStaticData(filePath: string,): Promise<DevTools.HeapSnapshotModel.HeapSnapshotModel.StaticData | null>;- getHeapSnapshotNodesByUid(+ getHeapSnapshotNodesById(filePath: string,- uid: number,+ id: number,): Promise<DevTools.HeapSnapshotModel.HeapSnapshotModel.ItemsRange>;getHeapSnapshotRetainers(filePath: string,diff --git a/src/tools/memory.ts b/src/tools/memory.tsindex 487fcef3..3b9552df 100644--- a/src/tools/memory.ts+++ b/src/tools/memory.ts@@ -10,8 +10,8 @@ import {ensureExtension} from '../utils/files.js';import {ToolCategory} from './categories.js';import {definePageTool, defineTool} from './ToolDefinition.js';-export const takeMemorySnapshot = definePageTool({- name: 'take_memory_snapshot',+export const takeHeapSnapshot = definePageTool({+ name: 'take_heapsnapshot',description: `Capture a heap snapshot of the currently selected page. Use to analyze the memory distribution of JavaScript objects and debug memory leaks.`,annotations: {category: ToolCategory.MEMORY,@@ -37,8 +37,8 @@ export const takeMemorySnapshot = definePageTool({},});-export const exploreMemorySnapshot = defineTool({- name: 'load_memory_snapshot',+export const getHeapSnapshotSummary = defineTool({+ name: 'get_heapsnapshot_summary',description:'Loads a memory heapsnapshot and returns snapshot summary stats.',annotations: {@@ -61,8 +61,8 @@ export const exploreMemorySnapshot = defineTool({},});-export const getMemorySnapshotDetails = defineTool({- name: 'get_memory_snapshot_details',+export const getHeapSnapshotDetails = defineTool({+ name: 'get_heapsnapshot_details',description:'Loads a memory heapsnapshot and returns all available information including statistics, static data, and aggregated node information. Supports pagination for aggregates.',annotations: {@@ -95,10 +95,10 @@ export const getMemorySnapshotDetails = defineTool({},});-export const getNodesByClass = defineTool({- name: 'get_nodes_by_class',+export const getHeapSnapshotClassNodes = defineTool({+ name: 'get_heapsnapshot_class_nodes',description:- 'Loads a memory heapsnapshot and returns instances of a specific class with their stable IDs.',+ 'Loads a memory heapsnapshot and returns instances of a specific class with their IDs.',annotations: {category: ToolCategory.MEMORY,readOnlyHint: true,@@ -106,20 +106,16 @@ export const getNodesByClass = defineTool({},schema: {filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),- uid: zod- .number()- .describe(- 'The unique UID for the class, obtained from aggregates listing.',- ),+ id: zod.number().describe('The ID for the class, obtained from details.'),pageIdx: zod.number().optional().describe('The page index for pagination.'),pageSize: zod.number().optional().describe('The page size for pagination.'),},blockedByDialog: false,handler: async (request, response, context) => {context.validatePath(request.params.filePath);- const nodes = await context.getHeapSnapshotNodesByUid(+ const nodes = await context.getHeapSnapshotNodesById(request.params.filePath,- request.params.uid,+ request.params.id,);response.setHeapSnapshotNodes(nodes, {@@ -129,8 +125,8 @@ export const getNodesByClass = defineTool({},});-export const getNodeRetainers = defineTool({- name: 'get_node_retainers',+export const getHeapSnapshotRetainers = defineTool({+ name: 'get_heapsnapshot_retainers',description:'Loads a memory heapsnapshot and returns retainers for a specific node ID.',annotations: {@@ -141,7 +137,7 @@ export const getNodeRetainers = defineTool({blockedByDialog: false,schema: {filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),- nodeId: zod.number().describe('The stable node ID to get retainers for.'),+ nodeId: zod.number().describe('The node ID to get retainers for.'),pageIdx: zod.number().optional().describe('The page index for pagination.'),pageSize: zod.number().optional().describe('The page size for pagination.'),},diff --git a/tests/formatters/HeapSnapshotFormatter.test.js.snapshot b/tests/formatters/HeapSnapshotFormatter.test.js.snapshotindex c2a0afc5..43240058 100644--- a/tests/formatters/HeapSnapshotFormatter.test.js.snapshot+++ b/tests/formatters/HeapSnapshotFormatter.test.js.snapshot@@ -1,5 +1,5 @@exports[`HeapSnapshotFormatter > toString > formats data as CSV and sorts by retained size 1`] = `-uid,className,count,selfSize,maxRetainedSize+id,name,count,selfSize,maxRetainedSize1,ObjectA,10,0.1 kB,1.0 kB2,ObjectB,5,0.1 kB,0.5 kB`;diff --git a/tests/formatters/HeapSnapshotFormatter.test.ts b/tests/formatters/HeapSnapshotFormatter.test.tsindex 9fd0e110..21860060 100644--- a/tests/formatters/HeapSnapshotFormatter.test.ts+++ b/tests/formatters/HeapSnapshotFormatter.test.ts@@ -59,14 +59,14 @@ describe('HeapSnapshotFormatter', () => {const result = formatter.toJSON();assert.deepStrictEqual(result, [{- uid: 1,+ id: 1,className: 'ObjectA',count: 10,selfSize: DevTools.I18n.ByteUtilities.formatBytesToKb(100),retainedSize: DevTools.I18n.ByteUtilities.formatBytesToKb(1000),},{- uid: 2,+ id: 2,className: 'ObjectB',count: 5,selfSize: DevTools.I18n.ByteUtilities.formatBytesToKb(50),@@ -121,9 +121,9 @@ describe('HeapSnapshotFormatter', () => {const result = HeapSnapshotFormatter.formatNodes(mockEdges);const expected = [- 'edgeIndex,edgeName,edgeType,targetNodeId,targetNodeName',- '0,edge1,property,1,NodeA',- '1,edge2,element,2,NodeB',+ 'name,type,nodeId,nodeName',+ 'edge1,property,1,NodeA',+ 'edge2,element,2,NodeB',].join('\n');assert.strictEqual(result, expected);diff --git a/tests/tools/memory.test.js.snapshot b/tests/tools/memory.test.js.snapshotindex 9267d766..1a9189d8 100644--- a/tests/tools/memory.test.js.snapshot+++ b/tests/tools/memory.test.js.snapshot@@ -1,7 +1,21 @@-exports[`memory > get_memory_snapshot_details > with default options 1`] = `+exports[`memory > get_heapsnapshot_class_nodes > with default options 1`] = `+## Heap Snapshot Data+nodeId,nodeName,type,distance,selfSize,retainedSize+25307,Array,object,2,0.2 kB,2.1 kB+46355,Array,object,2,0.2 kB,2.1 kB+33187,Array,object,2,0.2 kB,1.7 kB+36255,Array,object,2,0.2 kB,1.7 kB+45901,Array,object,5,0.1 kB,0.1 kB+46151,Array,object,5,0.1 kB,0.1 kB+45899,Array,object,5,0.1 kB,0.1 kB+46149,Array,object,5,0.1 kB,0.1 kB+Showing 1-8 of 8 (Page 1 of 1).+`;++exports[`memory > get_heapsnapshot_details > with default options 1`] = `## Heap Snapshot DataShowing 1-157 of 157 (Page 1 of 1).-uid,className,count,selfSize,maxRetainedSize+id,name,count,selfSize,maxRetainedSize2,(system),3205,199 kB,655 kB11,Function,3581,111 kB,237 kB16,(object shape),2878,181 kB,184 kB@@ -161,30 +175,16 @@ uid,className,count,selfSize,maxRetainedSize108,HTMLBodyElement (internal cache) / https://example.com,1,0.0 kB,0.0 kB`;-exports[`memory > get_node_retainers > with valid nodeId 1`] = `+exports[`memory > get_heapsnapshot_retainers > with valid nodeId 1`] = `## Heap Snapshot Data-edgeIndex,edgeName,edgeType,targetNodeId,targetNodeName-145296,prototype,internal,29287,system / Map-108096,prototype,property,25575,String-48828,initial_string_prototype,internal,7199,system / NativeContext+name,type,nodeId,nodeName+prototype,internal,29287,system / Map+prototype,property,25575,String+initial_string_prototype,internal,7199,system / NativeContextShowing 1-3 of 3 (Page 1 of 1).`;-exports[`memory > get_nodes_by_class > with default options 1`] = `-## Heap Snapshot Data-id,name,type,distance,selfSize,retainedSize-25307,Array,object,2,0.2 kB,2.1 kB-46355,Array,object,2,0.2 kB,2.1 kB-33187,Array,object,2,0.2 kB,1.7 kB-36255,Array,object,2,0.2 kB,1.7 kB-45901,Array,object,5,0.1 kB,0.1 kB-46151,Array,object,5,0.1 kB,0.1 kB-45899,Array,object,5,0.1 kB,0.1 kB-46149,Array,object,5,0.1 kB,0.1 kB-Showing 1-8 of 8 (Page 1 of 1).-`;--exports[`memory > load_memory_snapshot > with default options 1`] = `+exports[`memory > get_heapsnapshot_summary > with default options 1`] = `## Heap Snapshot DataStatistics: {"total": 1121496,diff --git a/tests/tools/memory.test.ts b/tests/tools/memory.test.tsindex 21a9e75c..ef98d123 100644--- a/tests/tools/memory.test.ts+++ b/tests/tools/memory.test.ts@@ -12,21 +12,21 @@ import {join} from 'node:path';import {describe, it} from 'node:test';import {- takeMemorySnapshot,- exploreMemorySnapshot,- getMemorySnapshotDetails,- getNodesByClass,- getNodeRetainers,+ takeHeapSnapshot,+ getHeapSnapshotSummary,+ getHeapSnapshotDetails,+ getHeapSnapshotClassNodes,+ getHeapSnapshotRetainers,} from '../../src/tools/memory.js';import {withMcpContext} from '../utils.js';describe('memory', () => {- describe('take_memory_snapshot', () => {+ describe('take_heapsnapshot', () => {it('with default options', async () => {await withMcpContext(async (response, context) => {const filePath = join(tmpdir(), 'test-screenshot.heapsnapshot');try {- await takeMemorySnapshot.handler(+ await takeHeapSnapshot.handler({params: {filePath}, page: context.getSelectedMcpPage()},response,context,@@ -43,7 +43,7 @@ describe('memory', () => {});});- describe('load_memory_snapshot', () => {+ describe('get_heapsnapshot_summary', () => {it('with default options', async t => {await withMcpContext(async (response, context) => {const filePath = join(@@ -53,7 +53,7 @@ describe('memory', () => {assert.ok(existsSync(filePath), `Fixture not found at ${filePath}`);- await exploreMemorySnapshot.handler(+ await getHeapSnapshotSummary.handler({params: {filePath}},response,context,@@ -61,7 +61,7 @@ describe('memory', () => {// Call handle to trigger formatting (similar to network tests)const responseData = await response.handle(- exploreMemorySnapshot.name,+ getHeapSnapshotSummary.name,context,);const output = responseData.content@@ -73,7 +73,7 @@ describe('memory', () => {});});- describe('get_memory_snapshot_details', () => {+ describe('get_heapsnapshot_details', () => {it('with default options', async t => {await withMcpContext(async (response, context) => {const filePath = join(@@ -81,14 +81,14 @@ describe('memory', () => {'tests/fixtures/example.heapsnapshot',);- await getMemorySnapshotDetails.handler(+ await getHeapSnapshotDetails.handler({params: {filePath}},response,context,);const responseData = await response.handle(- getMemorySnapshotDetails.name,+ getHeapSnapshotDetails.name,context,);const output = responseData.content@@ -100,7 +100,7 @@ describe('memory', () => {});});- describe('get_nodes_by_class', () => {+ describe('get_heapsnapshot_class_nodes', () => {it('with default options', async t => {await withMcpContext(async (response, context) => {const filePath = join(@@ -110,14 +110,14 @@ describe('memory', () => {await context.getHeapSnapshotAggregates(filePath);- await getNodesByClass.handler(- {params: {filePath, uid: 19}},+ await getHeapSnapshotClassNodes.handler(+ {params: {filePath, id: 19}},response,context,);const responseData = await response.handle(- getNodesByClass.name,+ getHeapSnapshotClassNodes.name,context,);@@ -139,18 +139,18 @@ describe('memory', () => {await context.getHeapSnapshotAggregates(filePath);await assert.rejects(- getNodesByClass.handler(- {params: {filePath, uid: 999999}},+ getHeapSnapshotClassNodes.handler(+ {params: {filePath, id: 999999}},response,context,),- {message: 'Class with UID 999999 not found in heap snapshot'},+ {message: 'Class with ID 999999 not found in heap snapshot'},);});});});- describe('get_node_retainers', () => {+ describe('get_heapsnapshot_retainers', () => {it('with valid nodeId', async t => {await withMcpContext(async (response, context) => {const filePath = join(@@ -158,14 +158,14 @@ describe('memory', () => {'tests/fixtures/example.heapsnapshot',);- await getNodeRetainers.handler(+ await getHeapSnapshotRetainers.handler({params: {filePath, nodeId: 25341}},response,context,);const responseData = await response.handle(- getNodeRetainers.name,+ getHeapSnapshotRetainers.name,context,);const output = responseData.content