chrome-devtools-mcp 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/build/src/DevToolsConnectionAdapter.js +1 -0
- package/build/src/DevtoolsUtils.js +1 -0
- package/build/src/HeapSnapshotManager.js +16 -0
- package/build/src/McpContext.js +54 -126
- package/build/src/McpPage.js +204 -0
- package/build/src/McpResponse.js +44 -6
- package/build/src/Mutex.js +1 -0
- package/build/src/PageCollector.js +1 -0
- package/build/src/SlimMcpResponse.js +1 -0
- package/build/src/TextSnapshot.js +236 -0
- package/build/src/WaitForHelper.js +6 -0
- package/build/src/bin/check-latest-version.js +1 -0
- package/build/src/bin/chrome-devtools-cli-options.js +206 -46
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +13 -1
- package/build/src/bin/chrome-devtools-mcp-main.js +1 -0
- package/build/src/bin/chrome-devtools-mcp.js +1 -0
- package/build/src/bin/chrome-devtools.js +27 -27
- package/build/src/browser.js +1 -0
- package/build/src/daemon/client.js +14 -12
- package/build/src/daemon/daemon.js +7 -5
- package/build/src/daemon/types.js +1 -0
- package/build/src/daemon/utils.js +20 -14
- package/build/src/formatters/ConsoleFormatter.js +48 -1
- package/build/src/formatters/HeapSnapshotFormatter.js +18 -2
- package/build/src/formatters/IssueFormatter.js +1 -0
- package/build/src/formatters/NetworkFormatter.js +1 -0
- package/build/src/formatters/SnapshotFormatter.js +2 -1
- package/build/src/index.js +114 -51
- package/build/src/issue-descriptions.js +1 -0
- package/build/src/logger.js +1 -0
- package/build/src/polyfill.js +1 -0
- package/build/src/telemetry/ClearcutLogger.js +13 -1
- package/build/src/telemetry/WatchdogClient.js +1 -0
- package/build/src/telemetry/flagUtils.js +1 -0
- package/build/src/telemetry/metricUtils.js +1 -0
- package/build/src/telemetry/persistence.js +1 -0
- package/build/src/telemetry/toolMetricsUtils.js +2 -1
- package/build/src/telemetry/types.js +1 -0
- package/build/src/telemetry/watchdog/ClearcutSender.js +1 -0
- package/build/src/telemetry/watchdog/main.js +1 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +32 -5
- package/build/src/third_party/bundled-packages.json +3 -2
- package/build/src/third_party/devtools-formatter-worker.js +2451 -2933
- package/build/src/third_party/devtools-heap-snapshot-worker.js +32 -26
- package/build/src/third_party/index.js +1942 -1536
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +21717 -20261
- package/build/src/tools/ToolDefinition.js +1 -0
- package/build/src/tools/categories.js +6 -2
- package/build/src/tools/console.js +3 -0
- package/build/src/tools/emulation.js +2 -0
- package/build/src/tools/extensions.js +6 -0
- package/build/src/tools/inPage.js +5 -35
- package/build/src/tools/input.js +13 -2
- package/build/src/tools/lighthouse.js +17 -9
- package/build/src/tools/memory.js +34 -1
- package/build/src/tools/network.js +7 -2
- package/build/src/tools/pages.js +218 -146
- package/build/src/tools/performance.js +6 -0
- package/build/src/tools/screencast.js +25 -10
- package/build/src/tools/screenshot.js +3 -0
- package/build/src/tools/script.js +2 -0
- package/build/src/tools/slim/tools.js +4 -0
- package/build/src/tools/snapshot.js +5 -1
- package/build/src/tools/tools.js +1 -0
- package/build/src/tools/webmcp.js +3 -0
- package/build/src/trace-processing/parse.js +1 -0
- package/build/src/types.js +1 -0
- package/build/src/utils/check-for-updates.js +1 -0
- package/build/src/utils/files.js +5 -10
- package/build/src/utils/id.js +1 -0
- package/build/src/utils/keyboard.js +1 -0
- package/build/src/utils/pagination.js +1 -0
- package/build/src/utils/string.js +1 -0
- package/build/src/utils/types.js +1 -0
- package/build/src/version.js +2 -1
- package/package.json +10 -9
- package/build/src/bin/cliDefinitions.js +0 -621
|
@@ -12,7 +12,7 @@ export var ToolCategory;
|
|
|
12
12
|
ToolCategory["NETWORK"] = "network";
|
|
13
13
|
ToolCategory["DEBUGGING"] = "debugging";
|
|
14
14
|
ToolCategory["EXTENSIONS"] = "extensions";
|
|
15
|
-
ToolCategory["IN_PAGE"] = "
|
|
15
|
+
ToolCategory["IN_PAGE"] = "experimentalInPage";
|
|
16
16
|
ToolCategory["MEMORY"] = "memory";
|
|
17
17
|
})(ToolCategory || (ToolCategory = {}));
|
|
18
18
|
export const labels = {
|
|
@@ -26,4 +26,8 @@ export const labels = {
|
|
|
26
26
|
[ToolCategory.IN_PAGE]: 'In-page tools',
|
|
27
27
|
[ToolCategory.MEMORY]: 'Memory',
|
|
28
28
|
};
|
|
29
|
-
export const OFF_BY_DEFAULT_CATEGORIES = [
|
|
29
|
+
export const OFF_BY_DEFAULT_CATEGORIES = [
|
|
30
|
+
ToolCategory.EXTENSIONS,
|
|
31
|
+
ToolCategory.IN_PAGE,
|
|
32
|
+
];
|
|
33
|
+
//# sourceMappingURL=categories.js.map
|
|
@@ -60,6 +60,7 @@ export const listConsoleMessages = definePageTool(cliArgs => {
|
|
|
60
60
|
.optional()
|
|
61
61
|
.describe('Set to true to return the preserved messages over the last 3 navigations.'),
|
|
62
62
|
},
|
|
63
|
+
blockedByDialog: false,
|
|
63
64
|
handler: async (request, response) => {
|
|
64
65
|
response.setIncludeConsoleData(true, {
|
|
65
66
|
pageSize: request.params.pageSize,
|
|
@@ -82,7 +83,9 @@ export const getConsoleMessage = definePageTool({
|
|
|
82
83
|
.number()
|
|
83
84
|
.describe('The msgid of a console message on the page from the listed console messages'),
|
|
84
85
|
},
|
|
86
|
+
blockedByDialog: false,
|
|
85
87
|
handler: async (request, response) => {
|
|
86
88
|
response.attachConsoleMessage(request.params.msgid);
|
|
87
89
|
},
|
|
88
90
|
});
|
|
91
|
+
//# sourceMappingURL=console.js.map
|
|
@@ -48,8 +48,10 @@ export const emulate = definePageTool({
|
|
|
48
48
|
.transform(viewportTransform)
|
|
49
49
|
.describe(`Emulate device viewports '<width>x<height>x<devicePixelRatio>[,mobile][,touch][,landscape]'. 'touch' and 'mobile' to emulate mobile devices. 'landscape' to emulate landscape mode.`),
|
|
50
50
|
},
|
|
51
|
+
blockedByDialog: true,
|
|
51
52
|
handler: async (request, _response, context) => {
|
|
52
53
|
const page = request.page;
|
|
53
54
|
await context.emulate(request.params, page.pptrPage);
|
|
54
55
|
},
|
|
55
56
|
});
|
|
57
|
+
//# sourceMappingURL=emulation.js.map
|
|
@@ -18,6 +18,7 @@ export const installExtension = defineTool({
|
|
|
18
18
|
.string()
|
|
19
19
|
.describe('Absolute path to the unpacked extension folder.'),
|
|
20
20
|
},
|
|
21
|
+
blockedByDialog: false,
|
|
21
22
|
handler: async (request, response, context) => {
|
|
22
23
|
const { path } = request.params;
|
|
23
24
|
const id = await context.installExtension(path);
|
|
@@ -34,6 +35,7 @@ export const uninstallExtension = defineTool({
|
|
|
34
35
|
schema: {
|
|
35
36
|
id: zod.string().describe('ID of the extension to uninstall.'),
|
|
36
37
|
},
|
|
38
|
+
blockedByDialog: false,
|
|
37
39
|
handler: async (request, response, context) => {
|
|
38
40
|
const { id } = request.params;
|
|
39
41
|
await context.uninstallExtension(id);
|
|
@@ -48,6 +50,7 @@ export const listExtensions = defineTool({
|
|
|
48
50
|
readOnlyHint: true,
|
|
49
51
|
},
|
|
50
52
|
schema: {},
|
|
53
|
+
blockedByDialog: false,
|
|
51
54
|
handler: async (_request, response, _context) => {
|
|
52
55
|
response.setListExtensions();
|
|
53
56
|
},
|
|
@@ -62,6 +65,7 @@ export const reloadExtension = defineTool({
|
|
|
62
65
|
schema: {
|
|
63
66
|
id: zod.string().describe('ID of the extension to reload.'),
|
|
64
67
|
},
|
|
68
|
+
blockedByDialog: false,
|
|
65
69
|
handler: async (request, response, context) => {
|
|
66
70
|
const { id } = request.params;
|
|
67
71
|
const extension = await context.getExtension(id);
|
|
@@ -82,9 +86,11 @@ export const triggerExtensionAction = defineTool({
|
|
|
82
86
|
schema: {
|
|
83
87
|
id: zod.string().describe('ID of the extension to trigger the action for.'),
|
|
84
88
|
},
|
|
89
|
+
blockedByDialog: false,
|
|
85
90
|
handler: async (request, response, context) => {
|
|
86
91
|
const { id } = request.params;
|
|
87
92
|
await context.triggerExtensionAction(id);
|
|
88
93
|
response.appendResponseLine(`Extension action triggered for ID ${id}`);
|
|
89
94
|
},
|
|
90
95
|
});
|
|
96
|
+
//# sourceMappingURL=extensions.js.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { zod, ajv
|
|
6
|
+
import { zod, ajv } from '../third_party/index.js';
|
|
7
7
|
import { ToolCategory } from './categories.js';
|
|
8
8
|
import { definePageTool } from './ToolDefinition.js';
|
|
9
9
|
export const listInPageTools = definePageTool({
|
|
@@ -18,9 +18,9 @@ export const listInPageTools = definePageTool({
|
|
|
18
18
|
annotations: {
|
|
19
19
|
category: ToolCategory.IN_PAGE,
|
|
20
20
|
readOnlyHint: true,
|
|
21
|
-
conditions: ['inPageTools'],
|
|
22
21
|
},
|
|
23
22
|
schema: {},
|
|
23
|
+
blockedByDialog: false,
|
|
24
24
|
handler: async (_request, response, _context) => {
|
|
25
25
|
response.setListInPageTools();
|
|
26
26
|
},
|
|
@@ -31,7 +31,6 @@ export const executeInPageTool = definePageTool({
|
|
|
31
31
|
annotations: {
|
|
32
32
|
category: ToolCategory.IN_PAGE,
|
|
33
33
|
readOnlyHint: false,
|
|
34
|
-
conditions: ['inPageTools'],
|
|
35
34
|
},
|
|
36
35
|
schema: {
|
|
37
36
|
toolName: zod.string().describe('The name of the tool to execute'),
|
|
@@ -40,6 +39,7 @@ export const executeInPageTool = definePageTool({
|
|
|
40
39
|
.optional()
|
|
41
40
|
.describe('The JSON-stringified parameters to pass to the tool'),
|
|
42
41
|
},
|
|
42
|
+
blockedByDialog: false,
|
|
43
43
|
handler: async (request, response) => {
|
|
44
44
|
const toolName = request.params.toolName;
|
|
45
45
|
let params = {};
|
|
@@ -58,19 +58,6 @@ export const executeInPageTool = definePageTool({
|
|
|
58
58
|
throw new Error(`Failed to parse params as JSON: ${errorMessage}`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
// Creates array of ElementHandles from the UIDs in the params.
|
|
62
|
-
// We do not replace the uids with the ElementsHandles yet, because
|
|
63
|
-
// the `evaluate` function only turns them into DOM elements if they
|
|
64
|
-
// are passed as non-nested arguments.
|
|
65
|
-
const handles = [];
|
|
66
|
-
for (const value of Object.values(params)) {
|
|
67
|
-
if (value instanceof Object &&
|
|
68
|
-
'uid' in value &&
|
|
69
|
-
typeof value.uid === 'string' &&
|
|
70
|
-
Object.keys(value).length === 1) {
|
|
71
|
-
handles.push(await request.page.getElementByUid(value.uid));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
61
|
const toolGroup = request.page.getInPageTools();
|
|
75
62
|
const tool = toolGroup?.tools.find(t => t.name === toolName);
|
|
76
63
|
if (!tool) {
|
|
@@ -82,24 +69,7 @@ export const executeInPageTool = definePageTool({
|
|
|
82
69
|
if (!valid) {
|
|
83
70
|
throw new Error(`Invalid parameters for tool ${toolName}: ${ajvInstance.errorsText(validate.errors)}`);
|
|
84
71
|
}
|
|
85
|
-
|
|
86
|
-
// Replace the UIDs with DOM elements.
|
|
87
|
-
for (const [key, value] of Object.entries(args)) {
|
|
88
|
-
if (value instanceof Object &&
|
|
89
|
-
'uid' in value &&
|
|
90
|
-
typeof value.uid === 'string' &&
|
|
91
|
-
Object.keys(value).length === 1) {
|
|
92
|
-
args[key] = elements.shift();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (!window.__dtmcp?.executeTool) {
|
|
96
|
-
throw new Error('No tools found on the page');
|
|
97
|
-
}
|
|
98
|
-
const toolResult = await window.__dtmcp.executeTool(name, args);
|
|
99
|
-
return {
|
|
100
|
-
result: toolResult,
|
|
101
|
-
};
|
|
102
|
-
}, toolName, params, ...handles);
|
|
103
|
-
response.appendResponseLine(JSON.stringify(result, null, 2));
|
|
72
|
+
await request.page.executeInPageTool(toolName, params, response);
|
|
104
73
|
},
|
|
105
74
|
});
|
|
75
|
+
//# sourceMappingURL=inPage.js.map
|
package/build/src/tools/input.js
CHANGED
|
@@ -40,6 +40,7 @@ export const click = definePageTool({
|
|
|
40
40
|
dblClick: dblClickSchema,
|
|
41
41
|
includeSnapshot: includeSnapshotSchema,
|
|
42
42
|
},
|
|
43
|
+
blockedByDialog: true,
|
|
43
44
|
handler: async (request, response) => {
|
|
44
45
|
const uid = request.params.uid;
|
|
45
46
|
const handle = await request.page.getElementByUid(uid);
|
|
@@ -70,7 +71,7 @@ export const clickAt = definePageTool({
|
|
|
70
71
|
annotations: {
|
|
71
72
|
category: ToolCategory.INPUT,
|
|
72
73
|
readOnlyHint: false,
|
|
73
|
-
conditions: ['
|
|
74
|
+
conditions: ['experimentalVision'],
|
|
74
75
|
},
|
|
75
76
|
schema: {
|
|
76
77
|
x: zod.number().describe('The x coordinate'),
|
|
@@ -78,6 +79,7 @@ export const clickAt = definePageTool({
|
|
|
78
79
|
dblClick: dblClickSchema,
|
|
79
80
|
includeSnapshot: includeSnapshotSchema,
|
|
80
81
|
},
|
|
82
|
+
blockedByDialog: true,
|
|
81
83
|
handler: async (request, response) => {
|
|
82
84
|
const page = request.page;
|
|
83
85
|
await page.waitForEventsAfterAction(async () => {
|
|
@@ -106,6 +108,7 @@ export const hover = definePageTool({
|
|
|
106
108
|
.describe('The uid of an element on the page from the page content snapshot'),
|
|
107
109
|
includeSnapshot: includeSnapshotSchema,
|
|
108
110
|
},
|
|
111
|
+
blockedByDialog: true,
|
|
109
112
|
handler: async (request, response) => {
|
|
110
113
|
const uid = request.params.uid;
|
|
111
114
|
const handle = await request.page.getElementByUid(uid);
|
|
@@ -200,6 +203,7 @@ export const fill = definePageTool({
|
|
|
200
203
|
value: zod.string().describe('The value to fill in'),
|
|
201
204
|
includeSnapshot: includeSnapshotSchema,
|
|
202
205
|
},
|
|
206
|
+
blockedByDialog: true,
|
|
203
207
|
handler: async (request, response, context) => {
|
|
204
208
|
const page = request.page;
|
|
205
209
|
await page.waitForEventsAfterAction(async () => {
|
|
@@ -222,6 +226,7 @@ export const typeText = definePageTool({
|
|
|
222
226
|
text: zod.string().describe('The text to type'),
|
|
223
227
|
submitKey: submitKeySchema,
|
|
224
228
|
},
|
|
229
|
+
blockedByDialog: true,
|
|
225
230
|
handler: async (request, response) => {
|
|
226
231
|
const page = request.page;
|
|
227
232
|
await page.waitForEventsAfterAction(async () => {
|
|
@@ -245,6 +250,7 @@ export const drag = definePageTool({
|
|
|
245
250
|
to_uid: zod.string().describe('The uid of the element to drop into'),
|
|
246
251
|
includeSnapshot: includeSnapshotSchema,
|
|
247
252
|
},
|
|
253
|
+
blockedByDialog: true,
|
|
248
254
|
handler: async (request, response) => {
|
|
249
255
|
const fromHandle = await request.page.getElementByUid(request.params.from_uid);
|
|
250
256
|
const toHandle = await request.page.getElementByUid(request.params.to_uid);
|
|
@@ -283,6 +289,7 @@ export const fillForm = definePageTool({
|
|
|
283
289
|
.describe('Elements from snapshot to fill out.'),
|
|
284
290
|
includeSnapshot: includeSnapshotSchema,
|
|
285
291
|
},
|
|
292
|
+
blockedByDialog: true,
|
|
286
293
|
handler: async (request, response, context) => {
|
|
287
294
|
const page = request.page;
|
|
288
295
|
for (const element of request.params.elements) {
|
|
@@ -310,8 +317,10 @@ export const uploadFile = definePageTool({
|
|
|
310
317
|
filePath: zod.string().describe('The local path of the file to upload'),
|
|
311
318
|
includeSnapshot: includeSnapshotSchema,
|
|
312
319
|
},
|
|
313
|
-
|
|
320
|
+
blockedByDialog: true,
|
|
321
|
+
handler: async (request, response, context) => {
|
|
314
322
|
const { uid, filePath } = request.params;
|
|
323
|
+
context.validatePath(filePath);
|
|
315
324
|
const handle = (await request.page.getElementByUid(uid));
|
|
316
325
|
try {
|
|
317
326
|
try {
|
|
@@ -355,6 +364,7 @@ export const pressKey = definePageTool({
|
|
|
355
364
|
.describe('A key or a combination (e.g., "Enter", "Control+A", "Control++", "Control+Shift+R"). Modifiers: Control, Shift, Alt, Meta'),
|
|
356
365
|
includeSnapshot: includeSnapshotSchema,
|
|
357
366
|
},
|
|
367
|
+
blockedByDialog: true,
|
|
358
368
|
handler: async (request, response) => {
|
|
359
369
|
const page = request.page;
|
|
360
370
|
const tokens = parseKey(request.params.key);
|
|
@@ -374,3 +384,4 @@ export const pressKey = definePageTool({
|
|
|
374
384
|
}
|
|
375
385
|
},
|
|
376
386
|
});
|
|
387
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import path from 'node:path';
|
|
7
|
-
import { snapshot, navigation, generateReport, zod, } from '../third_party/index.js';
|
|
7
|
+
import { snapshot, navigation, generateReport, zod, agenticBrowsingConfig, } from '../third_party/index.js';
|
|
8
8
|
import { ToolCategory } from './categories.js';
|
|
9
9
|
import { startTrace } from './performance.js';
|
|
10
10
|
import { definePageTool } from './ToolDefinition.js';
|
|
11
11
|
export const lighthouseAudit = definePageTool({
|
|
12
12
|
name: 'lighthouse_audit',
|
|
13
|
-
description: `Get Lighthouse score and reports for accessibility, SEO and
|
|
13
|
+
description: `Get Lighthouse score and reports for accessibility, SEO, best practices, and agentic browsing. This excludes performance. For performance audits, run ${startTrace.name}`,
|
|
14
14
|
annotations: {
|
|
15
15
|
category: ToolCategory.DEBUGGING,
|
|
16
16
|
readOnlyHint: false,
|
|
@@ -29,11 +29,18 @@ export const lighthouseAudit = definePageTool({
|
|
|
29
29
|
.optional()
|
|
30
30
|
.describe('Directory for reports. If omitted, uses temporary files.'),
|
|
31
31
|
},
|
|
32
|
+
blockedByDialog: true,
|
|
32
33
|
handler: async (request, response, context) => {
|
|
33
34
|
const page = request.page;
|
|
34
|
-
const categories = [
|
|
35
|
+
const categories = [
|
|
36
|
+
'accessibility',
|
|
37
|
+
'seo',
|
|
38
|
+
'best-practices',
|
|
39
|
+
'agentic-browsing',
|
|
40
|
+
];
|
|
35
41
|
const formats = ['json', 'html'];
|
|
36
42
|
const { mode = 'navigation', device = 'desktop', outputDirPath, } = request.params;
|
|
43
|
+
context.validatePath(outputDirPath);
|
|
37
44
|
const flags = {
|
|
38
45
|
onlyCategories: categories,
|
|
39
46
|
output: formats,
|
|
@@ -60,17 +67,17 @@ export const lighthouseAudit = definePageTool({
|
|
|
60
67
|
disabled: false,
|
|
61
68
|
};
|
|
62
69
|
}
|
|
70
|
+
const options = {
|
|
71
|
+
flags,
|
|
72
|
+
config: agenticBrowsingConfig,
|
|
73
|
+
};
|
|
63
74
|
let result;
|
|
64
75
|
try {
|
|
65
76
|
if (mode === 'navigation') {
|
|
66
|
-
result = await navigation(page.pptrPage, page.pptrPage.url(),
|
|
67
|
-
flags,
|
|
68
|
-
});
|
|
77
|
+
result = await navigation(page.pptrPage, page.pptrPage.url(), options);
|
|
69
78
|
}
|
|
70
79
|
else {
|
|
71
|
-
result = await snapshot(page.pptrPage,
|
|
72
|
-
flags,
|
|
73
|
-
});
|
|
80
|
+
result = await snapshot(page.pptrPage, options);
|
|
74
81
|
}
|
|
75
82
|
if (!result) {
|
|
76
83
|
throw new Error('Lighthouse audit failed.');
|
|
@@ -121,3 +128,4 @@ export const lighthouseAudit = definePageTool({
|
|
|
121
128
|
response.attachLighthouseResult(output);
|
|
122
129
|
},
|
|
123
130
|
});
|
|
131
|
+
//# sourceMappingURL=lighthouse.js.map
|
|
@@ -19,8 +19,10 @@ export const takeMemorySnapshot = definePageTool({
|
|
|
19
19
|
.string()
|
|
20
20
|
.describe('A path to a .heapsnapshot file to save the heapsnapshot to.'),
|
|
21
21
|
},
|
|
22
|
-
|
|
22
|
+
blockedByDialog: true,
|
|
23
|
+
handler: async (request, response, context) => {
|
|
23
24
|
const page = request.page;
|
|
25
|
+
context.validatePath(request.params.filePath);
|
|
24
26
|
await page.pptrPage.captureHeapSnapshot({
|
|
25
27
|
path: ensureExtension(request.params.filePath, '.heapsnapshot'),
|
|
26
28
|
});
|
|
@@ -38,7 +40,9 @@ export const exploreMemorySnapshot = defineTool({
|
|
|
38
40
|
schema: {
|
|
39
41
|
filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
|
|
40
42
|
},
|
|
43
|
+
blockedByDialog: false,
|
|
41
44
|
handler: async (request, response, context) => {
|
|
45
|
+
context.validatePath(request.params.filePath);
|
|
42
46
|
const stats = await context.getHeapSnapshotStats(request.params.filePath);
|
|
43
47
|
const staticData = await context.getHeapSnapshotStaticData(request.params.filePath);
|
|
44
48
|
response.setHeapSnapshotStats(stats, staticData);
|
|
@@ -63,7 +67,9 @@ export const getMemorySnapshotDetails = defineTool({
|
|
|
63
67
|
.optional()
|
|
64
68
|
.describe('The page size for pagination of aggregates.'),
|
|
65
69
|
},
|
|
70
|
+
blockedByDialog: false,
|
|
66
71
|
handler: async (request, response, context) => {
|
|
72
|
+
context.validatePath(request.params.filePath);
|
|
67
73
|
const aggregates = await context.getHeapSnapshotAggregates(request.params.filePath);
|
|
68
74
|
response.setHeapSnapshotAggregates(aggregates, {
|
|
69
75
|
pageIdx: request.params.pageIdx,
|
|
@@ -71,3 +77,30 @@ export const getMemorySnapshotDetails = defineTool({
|
|
|
71
77
|
});
|
|
72
78
|
},
|
|
73
79
|
});
|
|
80
|
+
export const getNodesByClass = defineTool({
|
|
81
|
+
name: 'get_nodes_by_class',
|
|
82
|
+
description: 'Loads a memory heapsnapshot and returns instances of a specific class with their stable IDs.',
|
|
83
|
+
annotations: {
|
|
84
|
+
category: ToolCategory.MEMORY,
|
|
85
|
+
readOnlyHint: true,
|
|
86
|
+
conditions: ['experimentalMemory'],
|
|
87
|
+
},
|
|
88
|
+
schema: {
|
|
89
|
+
filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
|
|
90
|
+
uid: zod
|
|
91
|
+
.number()
|
|
92
|
+
.describe('The unique UID for the class, obtained from aggregates listing.'),
|
|
93
|
+
pageIdx: zod.number().optional().describe('The page index for pagination.'),
|
|
94
|
+
pageSize: zod.number().optional().describe('The page size for pagination.'),
|
|
95
|
+
},
|
|
96
|
+
blockedByDialog: false,
|
|
97
|
+
handler: async (request, response, context) => {
|
|
98
|
+
context.validatePath(request.params.filePath);
|
|
99
|
+
const nodes = await context.getHeapSnapshotNodesByUid(request.params.filePath, request.params.uid);
|
|
100
|
+
response.setHeapSnapshotNodes(nodes, {
|
|
101
|
+
pageIdx: request.params.pageIdx,
|
|
102
|
+
pageSize: request.params.pageSize,
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -57,8 +57,9 @@ export const listNetworkRequests = definePageTool({
|
|
|
57
57
|
.optional()
|
|
58
58
|
.describe('Set to true to return the preserved requests over the last 3 navigations.'),
|
|
59
59
|
},
|
|
60
|
+
blockedByDialog: false,
|
|
60
61
|
handler: async (request, response, context) => {
|
|
61
|
-
const data = await
|
|
62
|
+
const data = await request.page.getDevToolsData();
|
|
62
63
|
response.attachDevToolsData(data);
|
|
63
64
|
const reqid = data?.cdpRequestId
|
|
64
65
|
? context.resolveCdpRequestId(request.page, data.cdpRequestId)
|
|
@@ -93,7 +94,10 @@ export const getNetworkRequest = definePageTool({
|
|
|
93
94
|
.optional()
|
|
94
95
|
.describe('The absolute or relative path to a .network-response file to save the response body to. If omitted, the body is returned inline.'),
|
|
95
96
|
},
|
|
97
|
+
blockedByDialog: true,
|
|
96
98
|
handler: async (request, response, context) => {
|
|
99
|
+
context.validatePath(request.params.requestFilePath);
|
|
100
|
+
context.validatePath(request.params.responseFilePath);
|
|
97
101
|
if (request.params.reqid) {
|
|
98
102
|
response.attachNetworkRequest(request.params.reqid, {
|
|
99
103
|
requestFilePath: request.params.requestFilePath,
|
|
@@ -101,7 +105,7 @@ export const getNetworkRequest = definePageTool({
|
|
|
101
105
|
});
|
|
102
106
|
}
|
|
103
107
|
else {
|
|
104
|
-
const data = await
|
|
108
|
+
const data = await request.page.getDevToolsData();
|
|
105
109
|
response.attachDevToolsData(data);
|
|
106
110
|
const reqid = data?.cdpRequestId
|
|
107
111
|
? context.resolveCdpRequestId(request.page, data.cdpRequestId)
|
|
@@ -118,3 +122,4 @@ export const getNetworkRequest = definePageTool({
|
|
|
118
122
|
}
|
|
119
123
|
},
|
|
120
124
|
});
|
|
125
|
+
//# sourceMappingURL=network.js.map
|