chrome-devtools-mcp 0.19.0 → 0.20.1
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 +10 -2
- package/build/src/DevtoolsUtils.js +0 -46
- package/build/src/McpContext.js +39 -32
- package/build/src/McpResponse.js +51 -19
- package/build/src/bin/chrome-devtools-cli-options.js +651 -0
- package/build/src/{cli.js → bin/chrome-devtools-mcp-cli-options.js} +1 -1
- package/build/src/{main.js → bin/chrome-devtools-mcp-main.js} +7 -7
- package/build/src/bin/chrome-devtools-mcp.js +21 -0
- package/build/src/bin/chrome-devtools.js +4 -3
- package/build/src/bin/cliDefinitions.js +0 -36
- package/build/src/browser.js +8 -9
- package/build/src/daemon/client.js +1 -0
- package/build/src/daemon/daemon.js +7 -2
- package/build/src/daemon/utils.js +1 -1
- package/build/src/index.js +204 -16
- package/build/src/third_party/THIRD_PARTY_NOTICES +1 -1
- package/build/src/third_party/bundled-packages.json +2 -2
- package/build/src/third_party/devtools-formatter-worker.js +0 -2
- package/build/src/third_party/index.js +309 -89
- package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
- package/build/src/version.js +1 -1
- package/package.json +8 -5
- package/build/src/server.js +0 -209
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export const commands = {
|
|
7
|
+
click: {
|
|
8
|
+
description: 'Clicks on the provided element',
|
|
9
|
+
category: 'Input automation',
|
|
10
|
+
args: {
|
|
11
|
+
uid: {
|
|
12
|
+
name: 'uid',
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'The uid of an element on the page from the page content snapshot',
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
dblClick: {
|
|
18
|
+
name: 'dblClick',
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
description: 'Set to true for double clicks. Default is false.',
|
|
21
|
+
required: false,
|
|
22
|
+
},
|
|
23
|
+
includeSnapshot: {
|
|
24
|
+
name: 'includeSnapshot',
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
description: 'Whether to include a snapshot in the response. Default is false.',
|
|
27
|
+
required: false,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
close_page: {
|
|
32
|
+
description: 'Closes the page by its index. The last open page cannot be closed.',
|
|
33
|
+
category: 'Navigation automation',
|
|
34
|
+
args: {
|
|
35
|
+
pageId: {
|
|
36
|
+
name: 'pageId',
|
|
37
|
+
type: 'number',
|
|
38
|
+
description: 'The ID of the page to close. Call list_pages to list pages.',
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
drag: {
|
|
44
|
+
description: 'Drag an element onto another element',
|
|
45
|
+
category: 'Input automation',
|
|
46
|
+
args: {
|
|
47
|
+
from_uid: {
|
|
48
|
+
name: 'from_uid',
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: 'The uid of the element to drag',
|
|
51
|
+
required: true,
|
|
52
|
+
},
|
|
53
|
+
to_uid: {
|
|
54
|
+
name: 'to_uid',
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'The uid of the element to drop into',
|
|
57
|
+
required: true,
|
|
58
|
+
},
|
|
59
|
+
includeSnapshot: {
|
|
60
|
+
name: 'includeSnapshot',
|
|
61
|
+
type: 'boolean',
|
|
62
|
+
description: 'Whether to include a snapshot in the response. Default is false.',
|
|
63
|
+
required: false,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
emulate: {
|
|
68
|
+
description: 'Emulates various features on the selected page.',
|
|
69
|
+
category: 'Emulation',
|
|
70
|
+
args: {
|
|
71
|
+
networkConditions: {
|
|
72
|
+
name: 'networkConditions',
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'Throttle network. Omit to disable throttling.',
|
|
75
|
+
required: false,
|
|
76
|
+
enum: ['Offline', 'Slow 3G', 'Fast 3G', 'Slow 4G', 'Fast 4G'],
|
|
77
|
+
},
|
|
78
|
+
cpuThrottlingRate: {
|
|
79
|
+
name: 'cpuThrottlingRate',
|
|
80
|
+
type: 'number',
|
|
81
|
+
description: 'Represents the CPU slowdown factor. Omit or set the rate to 1 to disable throttling',
|
|
82
|
+
required: false,
|
|
83
|
+
},
|
|
84
|
+
geolocation: {
|
|
85
|
+
name: 'geolocation',
|
|
86
|
+
type: 'string',
|
|
87
|
+
description: 'Geolocation (`<latitude>x<longitude>`) to emulate. Latitude between -90 and 90. Longitude between -180 and 180. Omit clear the geolocation override.',
|
|
88
|
+
required: false,
|
|
89
|
+
},
|
|
90
|
+
userAgent: {
|
|
91
|
+
name: 'userAgent',
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'User agent to emulate. Set to empty string to clear the user agent override.',
|
|
94
|
+
required: false,
|
|
95
|
+
},
|
|
96
|
+
colorScheme: {
|
|
97
|
+
name: 'colorScheme',
|
|
98
|
+
type: 'string',
|
|
99
|
+
description: 'Emulate the dark or the light mode. Set to "auto" to reset to the default.',
|
|
100
|
+
required: false,
|
|
101
|
+
enum: ['dark', 'light', 'auto'],
|
|
102
|
+
},
|
|
103
|
+
viewport: {
|
|
104
|
+
name: 'viewport',
|
|
105
|
+
type: 'string',
|
|
106
|
+
description: "Emulate device viewports '<width>x<height>x<devicePixelRatio>[,mobile][,touch][,landscape]'. 'touch' and 'mobile' to emulate mobile devices. 'landscape' to emulate landscape mode.",
|
|
107
|
+
required: false,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
evaluate_script: {
|
|
112
|
+
description: 'Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON,\nso returned values have to be JSON-serializable.',
|
|
113
|
+
category: 'Debugging',
|
|
114
|
+
args: {
|
|
115
|
+
function: {
|
|
116
|
+
name: 'function',
|
|
117
|
+
type: 'string',
|
|
118
|
+
description: 'A JavaScript function declaration to be executed by the tool in the currently selected page.\nExample without arguments: `() => {\n return document.title\n}` or `async () => {\n return await fetch("example.com")\n}`.\nExample with arguments: `(el) => {\n return el.innerText;\n}`\n',
|
|
119
|
+
required: true,
|
|
120
|
+
},
|
|
121
|
+
args: {
|
|
122
|
+
name: 'args',
|
|
123
|
+
type: 'array',
|
|
124
|
+
description: 'An optional list of arguments to pass to the function.',
|
|
125
|
+
required: false,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
fill: {
|
|
130
|
+
description: 'Type text into a input, text area or select an option from a <select> element.',
|
|
131
|
+
category: 'Input automation',
|
|
132
|
+
args: {
|
|
133
|
+
uid: {
|
|
134
|
+
name: 'uid',
|
|
135
|
+
type: 'string',
|
|
136
|
+
description: 'The uid of an element on the page from the page content snapshot',
|
|
137
|
+
required: true,
|
|
138
|
+
},
|
|
139
|
+
value: {
|
|
140
|
+
name: 'value',
|
|
141
|
+
type: 'string',
|
|
142
|
+
description: 'The value to fill in',
|
|
143
|
+
required: true,
|
|
144
|
+
},
|
|
145
|
+
includeSnapshot: {
|
|
146
|
+
name: 'includeSnapshot',
|
|
147
|
+
type: 'boolean',
|
|
148
|
+
description: 'Whether to include a snapshot in the response. Default is false.',
|
|
149
|
+
required: false,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
fill_form: {
|
|
154
|
+
description: 'Fill out multiple form elements at once',
|
|
155
|
+
category: 'Input automation',
|
|
156
|
+
args: {
|
|
157
|
+
elements: {
|
|
158
|
+
name: 'elements',
|
|
159
|
+
type: 'array',
|
|
160
|
+
description: 'Elements from snapshot to fill out.',
|
|
161
|
+
required: true,
|
|
162
|
+
},
|
|
163
|
+
includeSnapshot: {
|
|
164
|
+
name: 'includeSnapshot',
|
|
165
|
+
type: 'boolean',
|
|
166
|
+
description: 'Whether to include a snapshot in the response. Default is false.',
|
|
167
|
+
required: false,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
get_console_message: {
|
|
172
|
+
description: 'Gets a console message by its ID. You can get all messages by calling list_console_messages.',
|
|
173
|
+
category: 'Debugging',
|
|
174
|
+
args: {
|
|
175
|
+
msgid: {
|
|
176
|
+
name: 'msgid',
|
|
177
|
+
type: 'number',
|
|
178
|
+
description: 'The msgid of a console message on the page from the listed console messages',
|
|
179
|
+
required: true,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
get_network_request: {
|
|
184
|
+
description: 'Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.',
|
|
185
|
+
category: 'Network',
|
|
186
|
+
args: {
|
|
187
|
+
reqid: {
|
|
188
|
+
name: 'reqid',
|
|
189
|
+
type: 'number',
|
|
190
|
+
description: 'The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.',
|
|
191
|
+
required: false,
|
|
192
|
+
},
|
|
193
|
+
requestFilePath: {
|
|
194
|
+
name: 'requestFilePath',
|
|
195
|
+
type: 'string',
|
|
196
|
+
description: 'The absolute or relative path to save the request body to. If omitted, the body is returned inline.',
|
|
197
|
+
required: false,
|
|
198
|
+
},
|
|
199
|
+
responseFilePath: {
|
|
200
|
+
name: 'responseFilePath',
|
|
201
|
+
type: 'string',
|
|
202
|
+
description: 'The absolute or relative path to save the response body to. If omitted, the body is returned inline.',
|
|
203
|
+
required: false,
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
handle_dialog: {
|
|
208
|
+
description: 'If a browser dialog was opened, use this command to handle it',
|
|
209
|
+
category: 'Input automation',
|
|
210
|
+
args: {
|
|
211
|
+
action: {
|
|
212
|
+
name: 'action',
|
|
213
|
+
type: 'string',
|
|
214
|
+
description: 'Whether to dismiss or accept the dialog',
|
|
215
|
+
required: true,
|
|
216
|
+
enum: ['accept', 'dismiss'],
|
|
217
|
+
},
|
|
218
|
+
promptText: {
|
|
219
|
+
name: 'promptText',
|
|
220
|
+
type: 'string',
|
|
221
|
+
description: 'Optional prompt text to enter into the dialog.',
|
|
222
|
+
required: false,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
hover: {
|
|
227
|
+
description: 'Hover over the provided element',
|
|
228
|
+
category: 'Input automation',
|
|
229
|
+
args: {
|
|
230
|
+
uid: {
|
|
231
|
+
name: 'uid',
|
|
232
|
+
type: 'string',
|
|
233
|
+
description: 'The uid of an element on the page from the page content snapshot',
|
|
234
|
+
required: true,
|
|
235
|
+
},
|
|
236
|
+
includeSnapshot: {
|
|
237
|
+
name: 'includeSnapshot',
|
|
238
|
+
type: 'boolean',
|
|
239
|
+
description: 'Whether to include a snapshot in the response. Default is false.',
|
|
240
|
+
required: false,
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
lighthouse_audit: {
|
|
245
|
+
description: 'Get Lighthouse score and reports for accessibility, SEO and best practices. This excludes performance. For performance audits, run performance_start_trace',
|
|
246
|
+
category: 'Debugging',
|
|
247
|
+
args: {
|
|
248
|
+
mode: {
|
|
249
|
+
name: 'mode',
|
|
250
|
+
type: 'string',
|
|
251
|
+
description: '"navigation" reloads & audits. "snapshot" analyzes current state.',
|
|
252
|
+
required: false,
|
|
253
|
+
default: 'navigation',
|
|
254
|
+
enum: ['navigation', 'snapshot'],
|
|
255
|
+
},
|
|
256
|
+
device: {
|
|
257
|
+
name: 'device',
|
|
258
|
+
type: 'string',
|
|
259
|
+
description: 'Device to emulate.',
|
|
260
|
+
required: false,
|
|
261
|
+
default: 'desktop',
|
|
262
|
+
enum: ['desktop', 'mobile'],
|
|
263
|
+
},
|
|
264
|
+
outputDirPath: {
|
|
265
|
+
name: 'outputDirPath',
|
|
266
|
+
type: 'string',
|
|
267
|
+
description: 'Directory for reports. If omitted, uses temporary files.',
|
|
268
|
+
required: false,
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
list_console_messages: {
|
|
273
|
+
description: 'List all console messages for the currently selected page since the last navigation.',
|
|
274
|
+
category: 'Debugging',
|
|
275
|
+
args: {
|
|
276
|
+
pageSize: {
|
|
277
|
+
name: 'pageSize',
|
|
278
|
+
type: 'integer',
|
|
279
|
+
description: 'Maximum number of messages to return. When omitted, returns all requests.',
|
|
280
|
+
required: false,
|
|
281
|
+
},
|
|
282
|
+
pageIdx: {
|
|
283
|
+
name: 'pageIdx',
|
|
284
|
+
type: 'integer',
|
|
285
|
+
description: 'Page number to return (0-based). When omitted, returns the first page.',
|
|
286
|
+
required: false,
|
|
287
|
+
},
|
|
288
|
+
types: {
|
|
289
|
+
name: 'types',
|
|
290
|
+
type: 'array',
|
|
291
|
+
description: 'Filter messages to only return messages of the specified resource types. When omitted or empty, returns all messages.',
|
|
292
|
+
required: false,
|
|
293
|
+
},
|
|
294
|
+
includePreservedMessages: {
|
|
295
|
+
name: 'includePreservedMessages',
|
|
296
|
+
type: 'boolean',
|
|
297
|
+
description: 'Set to true to return the preserved messages over the last 3 navigations.',
|
|
298
|
+
required: false,
|
|
299
|
+
default: false,
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
list_network_requests: {
|
|
304
|
+
description: 'List all requests for the currently selected page since the last navigation.',
|
|
305
|
+
category: 'Network',
|
|
306
|
+
args: {
|
|
307
|
+
pageSize: {
|
|
308
|
+
name: 'pageSize',
|
|
309
|
+
type: 'integer',
|
|
310
|
+
description: 'Maximum number of requests to return. When omitted, returns all requests.',
|
|
311
|
+
required: false,
|
|
312
|
+
},
|
|
313
|
+
pageIdx: {
|
|
314
|
+
name: 'pageIdx',
|
|
315
|
+
type: 'integer',
|
|
316
|
+
description: 'Page number to return (0-based). When omitted, returns the first page.',
|
|
317
|
+
required: false,
|
|
318
|
+
},
|
|
319
|
+
resourceTypes: {
|
|
320
|
+
name: 'resourceTypes',
|
|
321
|
+
type: 'array',
|
|
322
|
+
description: 'Filter requests to only return requests of the specified resource types. When omitted or empty, returns all requests.',
|
|
323
|
+
required: false,
|
|
324
|
+
},
|
|
325
|
+
includePreservedRequests: {
|
|
326
|
+
name: 'includePreservedRequests',
|
|
327
|
+
type: 'boolean',
|
|
328
|
+
description: 'Set to true to return the preserved requests over the last 3 navigations.',
|
|
329
|
+
required: false,
|
|
330
|
+
default: false,
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
list_pages: {
|
|
335
|
+
description: 'Get a list of pages open in the browser.',
|
|
336
|
+
category: 'Navigation automation',
|
|
337
|
+
args: {},
|
|
338
|
+
},
|
|
339
|
+
navigate_page: {
|
|
340
|
+
description: 'Go to a URL, or back, forward, or reload. Use project URL if not specified otherwise.',
|
|
341
|
+
category: 'Navigation automation',
|
|
342
|
+
args: {
|
|
343
|
+
type: {
|
|
344
|
+
name: 'type',
|
|
345
|
+
type: 'string',
|
|
346
|
+
description: 'Navigate the page by URL, back or forward in history, or reload.',
|
|
347
|
+
required: false,
|
|
348
|
+
enum: ['url', 'back', 'forward', 'reload'],
|
|
349
|
+
},
|
|
350
|
+
url: {
|
|
351
|
+
name: 'url',
|
|
352
|
+
type: 'string',
|
|
353
|
+
description: 'Target URL (only type=url)',
|
|
354
|
+
required: false,
|
|
355
|
+
},
|
|
356
|
+
ignoreCache: {
|
|
357
|
+
name: 'ignoreCache',
|
|
358
|
+
type: 'boolean',
|
|
359
|
+
description: 'Whether to ignore cache on reload.',
|
|
360
|
+
required: false,
|
|
361
|
+
},
|
|
362
|
+
handleBeforeUnload: {
|
|
363
|
+
name: 'handleBeforeUnload',
|
|
364
|
+
type: 'string',
|
|
365
|
+
description: 'Whether to auto accept or beforeunload dialogs triggered by this navigation. Default is accept.',
|
|
366
|
+
required: false,
|
|
367
|
+
enum: ['accept', 'decline'],
|
|
368
|
+
},
|
|
369
|
+
initScript: {
|
|
370
|
+
name: 'initScript',
|
|
371
|
+
type: 'string',
|
|
372
|
+
description: 'A JavaScript script to be executed on each new document before any other scripts for the next navigation.',
|
|
373
|
+
required: false,
|
|
374
|
+
},
|
|
375
|
+
timeout: {
|
|
376
|
+
name: 'timeout',
|
|
377
|
+
type: 'integer',
|
|
378
|
+
description: 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.',
|
|
379
|
+
required: false,
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
new_page: {
|
|
384
|
+
description: 'Open a new tab and load a URL. Use project URL if not specified otherwise.',
|
|
385
|
+
category: 'Navigation automation',
|
|
386
|
+
args: {
|
|
387
|
+
url: {
|
|
388
|
+
name: 'url',
|
|
389
|
+
type: 'string',
|
|
390
|
+
description: 'URL to load in a new page.',
|
|
391
|
+
required: true,
|
|
392
|
+
},
|
|
393
|
+
background: {
|
|
394
|
+
name: 'background',
|
|
395
|
+
type: 'boolean',
|
|
396
|
+
description: 'Whether to open the page in the background without bringing it to the front. Default is false (foreground).',
|
|
397
|
+
required: false,
|
|
398
|
+
},
|
|
399
|
+
isolatedContext: {
|
|
400
|
+
name: 'isolatedContext',
|
|
401
|
+
type: 'string',
|
|
402
|
+
description: 'If specified, the page is created in an isolated browser context with the given name. Pages in the same browser context share cookies and storage. Pages in different browser contexts are fully isolated.',
|
|
403
|
+
required: false,
|
|
404
|
+
},
|
|
405
|
+
timeout: {
|
|
406
|
+
name: 'timeout',
|
|
407
|
+
type: 'integer',
|
|
408
|
+
description: 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.',
|
|
409
|
+
required: false,
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
performance_analyze_insight: {
|
|
414
|
+
description: 'Provides more detailed information on a specific Performance Insight of an insight set that was highlighted in the results of a trace recording.',
|
|
415
|
+
category: 'Performance',
|
|
416
|
+
args: {
|
|
417
|
+
insightSetId: {
|
|
418
|
+
name: 'insightSetId',
|
|
419
|
+
type: 'string',
|
|
420
|
+
description: 'The id for the specific insight set. Only use the ids given in the "Available insight sets" list.',
|
|
421
|
+
required: true,
|
|
422
|
+
},
|
|
423
|
+
insightName: {
|
|
424
|
+
name: 'insightName',
|
|
425
|
+
type: 'string',
|
|
426
|
+
description: 'The name of the Insight you want more information on. For example: "DocumentLatency" or "LCPBreakdown"',
|
|
427
|
+
required: true,
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
performance_start_trace: {
|
|
432
|
+
description: 'Start a performance trace on the selected webpage. Use to find frontend performance issues, Core Web Vitals (LCP, INP, CLS), and improve page load speed.',
|
|
433
|
+
category: 'Performance',
|
|
434
|
+
args: {
|
|
435
|
+
reload: {
|
|
436
|
+
name: 'reload',
|
|
437
|
+
type: 'boolean',
|
|
438
|
+
description: 'Determines if, once tracing has started, the current selected page should be automatically reloaded. Navigate the page to the right URL using the navigate_page tool BEFORE starting the trace if reload or autoStop is set to true.',
|
|
439
|
+
required: false,
|
|
440
|
+
default: true,
|
|
441
|
+
},
|
|
442
|
+
autoStop: {
|
|
443
|
+
name: 'autoStop',
|
|
444
|
+
type: 'boolean',
|
|
445
|
+
description: 'Determines if the trace recording should be automatically stopped.',
|
|
446
|
+
required: false,
|
|
447
|
+
default: true,
|
|
448
|
+
},
|
|
449
|
+
filePath: {
|
|
450
|
+
name: 'filePath',
|
|
451
|
+
type: 'string',
|
|
452
|
+
description: 'The absolute file path, or a file path relative to the current working directory, to save the raw trace data. For example, trace.json.gz (compressed) or trace.json (uncompressed).',
|
|
453
|
+
required: false,
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
performance_stop_trace: {
|
|
458
|
+
description: 'Stop the active performance trace recording on the selected webpage.',
|
|
459
|
+
category: 'Performance',
|
|
460
|
+
args: {
|
|
461
|
+
filePath: {
|
|
462
|
+
name: 'filePath',
|
|
463
|
+
type: 'string',
|
|
464
|
+
description: 'The absolute file path, or a file path relative to the current working directory, to save the raw trace data. For example, trace.json.gz (compressed) or trace.json (uncompressed).',
|
|
465
|
+
required: false,
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
press_key: {
|
|
470
|
+
description: 'Press a key or key combination. Use this when other input methods like fill() cannot be used (e.g., keyboard shortcuts, navigation keys, or special key combinations).',
|
|
471
|
+
category: 'Input automation',
|
|
472
|
+
args: {
|
|
473
|
+
key: {
|
|
474
|
+
name: 'key',
|
|
475
|
+
type: 'string',
|
|
476
|
+
description: 'A key or a combination (e.g., "Enter", "Control+A", "Control++", "Control+Shift+R"). Modifiers: Control, Shift, Alt, Meta',
|
|
477
|
+
required: true,
|
|
478
|
+
},
|
|
479
|
+
includeSnapshot: {
|
|
480
|
+
name: 'includeSnapshot',
|
|
481
|
+
type: 'boolean',
|
|
482
|
+
description: 'Whether to include a snapshot in the response. Default is false.',
|
|
483
|
+
required: false,
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
},
|
|
487
|
+
resize_page: {
|
|
488
|
+
description: "Resizes the selected page's window so that the page has specified dimension",
|
|
489
|
+
category: 'Emulation',
|
|
490
|
+
args: {
|
|
491
|
+
width: {
|
|
492
|
+
name: 'width',
|
|
493
|
+
type: 'number',
|
|
494
|
+
description: 'Page width',
|
|
495
|
+
required: true,
|
|
496
|
+
},
|
|
497
|
+
height: {
|
|
498
|
+
name: 'height',
|
|
499
|
+
type: 'number',
|
|
500
|
+
description: 'Page height',
|
|
501
|
+
required: true,
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
select_page: {
|
|
506
|
+
description: 'Select a page as a context for future tool calls.',
|
|
507
|
+
category: 'Navigation automation',
|
|
508
|
+
args: {
|
|
509
|
+
pageId: {
|
|
510
|
+
name: 'pageId',
|
|
511
|
+
type: 'number',
|
|
512
|
+
description: 'The ID of the page to select. Call list_pages to get available pages.',
|
|
513
|
+
required: true,
|
|
514
|
+
},
|
|
515
|
+
bringToFront: {
|
|
516
|
+
name: 'bringToFront',
|
|
517
|
+
type: 'boolean',
|
|
518
|
+
description: 'Whether to focus the page and bring it to the top.',
|
|
519
|
+
required: false,
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
take_memory_snapshot: {
|
|
524
|
+
description: 'Capture a memory heapsnapshot of the currently selected page to memory leak debugging',
|
|
525
|
+
category: 'Performance',
|
|
526
|
+
args: {
|
|
527
|
+
filePath: {
|
|
528
|
+
name: 'filePath',
|
|
529
|
+
type: 'string',
|
|
530
|
+
description: 'A path to a .heapsnapshot file to save the heapsnapshot to.',
|
|
531
|
+
required: true,
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
},
|
|
535
|
+
take_screenshot: {
|
|
536
|
+
description: 'Take a screenshot of the page or element.',
|
|
537
|
+
category: 'Debugging',
|
|
538
|
+
args: {
|
|
539
|
+
format: {
|
|
540
|
+
name: 'format',
|
|
541
|
+
type: 'string',
|
|
542
|
+
description: 'Type of format to save the screenshot as. Default is "png"',
|
|
543
|
+
required: false,
|
|
544
|
+
default: 'png',
|
|
545
|
+
enum: ['png', 'jpeg', 'webp'],
|
|
546
|
+
},
|
|
547
|
+
quality: {
|
|
548
|
+
name: 'quality',
|
|
549
|
+
type: 'number',
|
|
550
|
+
description: 'Compression quality for JPEG and WebP formats (0-100). Higher values mean better quality but larger file sizes. Ignored for PNG format.',
|
|
551
|
+
required: false,
|
|
552
|
+
},
|
|
553
|
+
uid: {
|
|
554
|
+
name: 'uid',
|
|
555
|
+
type: 'string',
|
|
556
|
+
description: 'The uid of an element on the page from the page content snapshot. If omitted takes a pages screenshot.',
|
|
557
|
+
required: false,
|
|
558
|
+
},
|
|
559
|
+
fullPage: {
|
|
560
|
+
name: 'fullPage',
|
|
561
|
+
type: 'boolean',
|
|
562
|
+
description: 'If set to true takes a screenshot of the full page instead of the currently visible viewport. Incompatible with uid.',
|
|
563
|
+
required: false,
|
|
564
|
+
},
|
|
565
|
+
filePath: {
|
|
566
|
+
name: 'filePath',
|
|
567
|
+
type: 'string',
|
|
568
|
+
description: 'The absolute path, or a path relative to the current working directory, to save the screenshot to instead of attaching it to the response.',
|
|
569
|
+
required: false,
|
|
570
|
+
},
|
|
571
|
+
},
|
|
572
|
+
},
|
|
573
|
+
take_snapshot: {
|
|
574
|
+
description: 'Take a text snapshot of the currently selected page based on the a11y tree. The snapshot lists page elements along with a unique\nidentifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected\nin the DevTools Elements panel (if any).',
|
|
575
|
+
category: 'Debugging',
|
|
576
|
+
args: {
|
|
577
|
+
verbose: {
|
|
578
|
+
name: 'verbose',
|
|
579
|
+
type: 'boolean',
|
|
580
|
+
description: 'Whether to include all possible information available in the full a11y tree. Default is false.',
|
|
581
|
+
required: false,
|
|
582
|
+
},
|
|
583
|
+
filePath: {
|
|
584
|
+
name: 'filePath',
|
|
585
|
+
type: 'string',
|
|
586
|
+
description: 'The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.',
|
|
587
|
+
required: false,
|
|
588
|
+
},
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
type_text: {
|
|
592
|
+
description: 'Type text using keyboard into a previously focused input',
|
|
593
|
+
category: 'Input automation',
|
|
594
|
+
args: {
|
|
595
|
+
text: {
|
|
596
|
+
name: 'text',
|
|
597
|
+
type: 'string',
|
|
598
|
+
description: 'The text to type',
|
|
599
|
+
required: true,
|
|
600
|
+
},
|
|
601
|
+
submitKey: {
|
|
602
|
+
name: 'submitKey',
|
|
603
|
+
type: 'string',
|
|
604
|
+
description: 'Optional key to press after typing. E.g., "Enter", "Tab", "Escape"',
|
|
605
|
+
required: false,
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
upload_file: {
|
|
610
|
+
description: 'Upload a file through a provided element.',
|
|
611
|
+
category: 'Input automation',
|
|
612
|
+
args: {
|
|
613
|
+
uid: {
|
|
614
|
+
name: 'uid',
|
|
615
|
+
type: 'string',
|
|
616
|
+
description: 'The uid of the file input element or an element that will open file chooser on the page from the page content snapshot',
|
|
617
|
+
required: true,
|
|
618
|
+
},
|
|
619
|
+
filePath: {
|
|
620
|
+
name: 'filePath',
|
|
621
|
+
type: 'string',
|
|
622
|
+
description: 'The local path of the file to upload',
|
|
623
|
+
required: true,
|
|
624
|
+
},
|
|
625
|
+
includeSnapshot: {
|
|
626
|
+
name: 'includeSnapshot',
|
|
627
|
+
type: 'boolean',
|
|
628
|
+
description: 'Whether to include a snapshot in the response. Default is false.',
|
|
629
|
+
required: false,
|
|
630
|
+
},
|
|
631
|
+
},
|
|
632
|
+
},
|
|
633
|
+
wait_for: {
|
|
634
|
+
description: 'Wait for the specified text to appear on the selected page.',
|
|
635
|
+
category: 'Navigation automation',
|
|
636
|
+
args: {
|
|
637
|
+
text: {
|
|
638
|
+
name: 'text',
|
|
639
|
+
type: 'array',
|
|
640
|
+
description: 'Non-empty list of texts. Resolves when any value appears on the page.',
|
|
641
|
+
required: true,
|
|
642
|
+
},
|
|
643
|
+
timeout: {
|
|
644
|
+
name: 'timeout',
|
|
645
|
+
type: 'integer',
|
|
646
|
+
description: 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.',
|
|
647
|
+
required: false,
|
|
648
|
+
},
|
|
649
|
+
},
|
|
650
|
+
},
|
|
651
|
+
};
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import '
|
|
6
|
+
import '../polyfill.js';
|
|
7
7
|
import process from 'node:process';
|
|
8
|
-
import {
|
|
9
|
-
import { logger, saveLogsToFile } from '
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
8
|
+
import { createMcpServer, logDisclaimers } from '../index.js';
|
|
9
|
+
import { logger, saveLogsToFile } from '../logger.js';
|
|
10
|
+
import { computeFlagUsage } from '../telemetry/flagUtils.js';
|
|
11
|
+
import { StdioServerTransport } from '../third_party/index.js';
|
|
12
|
+
import { VERSION } from '../version.js';
|
|
13
|
+
import { cliOptions, parseArguments } from './chrome-devtools-mcp-cli-options.js';
|
|
14
14
|
export const args = parseArguments(VERSION);
|
|
15
15
|
const logFile = args.logFile ? saveLogsToFile(args.logFile) : undefined;
|
|
16
16
|
if (process.env['CI'] ||
|