mcp-browser-dev-tools 0.0.4 → 0.0.6-beta.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/package.json +2 -1
- package/src/app.mjs +1 -0
- package/src/cdp-client.mjs +120 -20
- package/src/cli.mjs +1 -0
- package/src/config.mjs +2 -0
- package/src/firefox-bidi-client.mjs +127 -22
- package/src/keyboard.mjs +278 -0
- package/src/logger.mjs +11 -1
- package/src/mcp-server.mjs +132 -37
- package/src/page-context.mjs +210 -88
package/src/logger.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { appendFileSync } from "node:fs";
|
|
1
2
|
import process from "node:process";
|
|
2
3
|
|
|
3
4
|
import { PACKAGE_NAME } from "./package-info.mjs";
|
|
@@ -21,6 +22,7 @@ export function createLogger({
|
|
|
21
22
|
level = "error",
|
|
22
23
|
output = process.stderr,
|
|
23
24
|
name = PACKAGE_NAME,
|
|
25
|
+
filePath = null,
|
|
24
26
|
} = {}) {
|
|
25
27
|
const threshold = LOG_LEVELS[level] ?? LOG_LEVELS.error;
|
|
26
28
|
|
|
@@ -34,7 +36,15 @@ export function createLogger({
|
|
|
34
36
|
return false;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
const line = `[${name}] ${messageLevel}: ${normalizeMessage(message)}\n`;
|
|
40
|
+
output.write(line);
|
|
41
|
+
if (filePath != null) {
|
|
42
|
+
try {
|
|
43
|
+
appendFileSync(filePath, line);
|
|
44
|
+
} catch {
|
|
45
|
+
// ignore file write errors to avoid crashing the server
|
|
46
|
+
}
|
|
47
|
+
}
|
|
38
48
|
return true;
|
|
39
49
|
},
|
|
40
50
|
error(message, options) {
|
package/src/mcp-server.mjs
CHANGED
|
@@ -143,10 +143,13 @@ function sessionWithLimitSchema(description) {
|
|
|
143
143
|
properties: {
|
|
144
144
|
sessionId: {
|
|
145
145
|
type: "string",
|
|
146
|
+
description: "Session id returned by attach_tab.",
|
|
146
147
|
},
|
|
147
148
|
limit: {
|
|
148
149
|
type: "integer",
|
|
149
150
|
minimum: 1,
|
|
151
|
+
description:
|
|
152
|
+
"Return the most recent N entries from the session buffer (default 50).",
|
|
150
153
|
},
|
|
151
154
|
},
|
|
152
155
|
required: ["sessionId"],
|
|
@@ -155,12 +158,23 @@ function sessionWithLimitSchema(description) {
|
|
|
155
158
|
};
|
|
156
159
|
}
|
|
157
160
|
|
|
161
|
+
const LOCATOR_DESCRIPTION =
|
|
162
|
+
'Element locator. Plain CSS (or css=...) resolves to the first document.querySelector match. text=Foo resolves to the first visible element whose whitespace-normalized text equals Foo, falling back to the first whose text contains Foo; elements are scanned in document order, so this can resolve to a wrapper around the element you want. role=button or role=button[name="Save"] matches by explicit or implicit ARIA role and, optionally, accessible name (equal or containing), without a visibility check. name=Foo resolves to the first visible element whose accessible name (aria-label, aria-labelledby, associated label, alt, and so on) equals or contains Foo. Text comparisons are case-sensitive. Only the top-level document is searched: elements inside iframes or shadow roots are not found.';
|
|
163
|
+
|
|
164
|
+
function selectorProperty() {
|
|
165
|
+
return {
|
|
166
|
+
type: "string",
|
|
167
|
+
description: LOCATOR_DESCRIPTION,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
158
171
|
function sessionSchema(properties, required, description) {
|
|
159
172
|
return {
|
|
160
173
|
type: "object",
|
|
161
174
|
properties: {
|
|
162
175
|
sessionId: {
|
|
163
176
|
type: "string",
|
|
177
|
+
description: "Session id returned by attach_tab.",
|
|
164
178
|
},
|
|
165
179
|
...properties,
|
|
166
180
|
},
|
|
@@ -174,6 +188,8 @@ function waitUntilProperty() {
|
|
|
174
188
|
return {
|
|
175
189
|
type: "string",
|
|
176
190
|
enum: ["none", "interactive", "complete"],
|
|
191
|
+
description:
|
|
192
|
+
"When to return: none returns once navigation starts, interactive after DOMContentLoaded, complete after the load event (default complete).",
|
|
177
193
|
};
|
|
178
194
|
}
|
|
179
195
|
|
|
@@ -183,31 +199,38 @@ function waitForInputSchema() {
|
|
|
183
199
|
properties: {
|
|
184
200
|
sessionId: {
|
|
185
201
|
type: "string",
|
|
202
|
+
description: "Session id returned by attach_tab.",
|
|
186
203
|
},
|
|
187
|
-
selector:
|
|
188
|
-
type: "string",
|
|
189
|
-
},
|
|
204
|
+
selector: selectorProperty(),
|
|
190
205
|
state: {
|
|
191
206
|
type: "string",
|
|
192
207
|
enum: ["present", "visible", "hidden"],
|
|
208
|
+
description:
|
|
209
|
+
"Selector state to wait for (default visible). present: in the DOM. hidden: absent or not visible. Requires selector.",
|
|
193
210
|
},
|
|
194
211
|
url: {
|
|
195
212
|
type: "string",
|
|
213
|
+
description: "Wait until the page URL equals this string exactly.",
|
|
196
214
|
},
|
|
197
215
|
urlIncludes: {
|
|
198
216
|
type: "string",
|
|
217
|
+
description: "Wait until the page URL contains this string.",
|
|
199
218
|
},
|
|
200
219
|
readyState: {
|
|
201
220
|
type: "string",
|
|
202
221
|
enum: ["interactive", "complete"],
|
|
222
|
+
description:
|
|
223
|
+
"Wait until document.readyState reaches this state or later.",
|
|
203
224
|
},
|
|
204
225
|
timeoutMs: {
|
|
205
226
|
type: "integer",
|
|
206
227
|
minimum: 1,
|
|
228
|
+
description: "How long to wait before failing (default 10000).",
|
|
207
229
|
},
|
|
208
230
|
pollIntervalMs: {
|
|
209
231
|
type: "integer",
|
|
210
232
|
minimum: 1,
|
|
233
|
+
description: "Delay between checks (default 100).",
|
|
211
234
|
},
|
|
212
235
|
},
|
|
213
236
|
required: ["sessionId"],
|
|
@@ -221,9 +244,11 @@ function compareSessionsSchema(properties, required) {
|
|
|
221
244
|
properties: {
|
|
222
245
|
sessionIdA: {
|
|
223
246
|
type: "string",
|
|
247
|
+
description: "Session id returned by attach_tab.",
|
|
224
248
|
},
|
|
225
249
|
sessionIdB: {
|
|
226
250
|
type: "string",
|
|
251
|
+
description: "Session id returned by attach_tab.",
|
|
227
252
|
},
|
|
228
253
|
...properties,
|
|
229
254
|
},
|
|
@@ -238,10 +263,12 @@ function storageInputSchema() {
|
|
|
238
263
|
properties: {
|
|
239
264
|
sessionId: {
|
|
240
265
|
type: "string",
|
|
266
|
+
description: "Session id returned by attach_tab.",
|
|
241
267
|
},
|
|
242
268
|
area: {
|
|
243
269
|
type: "string",
|
|
244
270
|
enum: ["all", "localStorage", "sessionStorage"],
|
|
271
|
+
description: "Which storage to return (default all).",
|
|
245
272
|
},
|
|
246
273
|
},
|
|
247
274
|
required: ["sessionId"],
|
|
@@ -255,21 +282,26 @@ function captureDebugReportInputSchema(browserFamily) {
|
|
|
255
282
|
properties: {
|
|
256
283
|
sessionId: {
|
|
257
284
|
type: "string",
|
|
285
|
+
description: "Session id returned by attach_tab.",
|
|
258
286
|
},
|
|
259
287
|
consoleLimit: {
|
|
260
288
|
type: "integer",
|
|
261
289
|
minimum: 1,
|
|
290
|
+
description: "Most recent console entries to include (default 20).",
|
|
262
291
|
},
|
|
263
292
|
networkLimit: {
|
|
264
293
|
type: "integer",
|
|
265
294
|
minimum: 1,
|
|
295
|
+
description: "Most recent network requests to include (default 20).",
|
|
266
296
|
},
|
|
267
297
|
includeScreenshot: {
|
|
268
298
|
type: "boolean",
|
|
299
|
+
description: "Include a viewport screenshot (default true).",
|
|
269
300
|
},
|
|
270
301
|
screenshotFormat: {
|
|
271
302
|
type: "string",
|
|
272
303
|
enum: screenshotFormatsFor(browserFamily),
|
|
304
|
+
description: "Screenshot image format (default png).",
|
|
273
305
|
},
|
|
274
306
|
},
|
|
275
307
|
required: ["sessionId"],
|
|
@@ -283,12 +315,17 @@ function restoreSessionSnapshotInputSchema() {
|
|
|
283
315
|
properties: {
|
|
284
316
|
sessionId: {
|
|
285
317
|
type: "string",
|
|
318
|
+
description: "Session id returned by attach_tab.",
|
|
286
319
|
},
|
|
287
320
|
snapshot: {
|
|
288
321
|
type: "string",
|
|
322
|
+
description:
|
|
323
|
+
"The JSON output of capture_session_snapshot, as a string. Only entries for the current page origin are restored.",
|
|
289
324
|
},
|
|
290
325
|
clearStorage: {
|
|
291
326
|
type: "boolean",
|
|
327
|
+
description:
|
|
328
|
+
"Clear localStorage and sessionStorage before restoring (default false).",
|
|
292
329
|
},
|
|
293
330
|
},
|
|
294
331
|
required: ["sessionId", "snapshot"],
|
|
@@ -300,6 +337,7 @@ function newTabInputSchema(browserFamily) {
|
|
|
300
337
|
const properties = {
|
|
301
338
|
url: {
|
|
302
339
|
type: "string",
|
|
340
|
+
description: "URL to open (default about:blank).",
|
|
303
341
|
},
|
|
304
342
|
};
|
|
305
343
|
const required = [];
|
|
@@ -308,6 +346,7 @@ function newTabInputSchema(browserFamily) {
|
|
|
308
346
|
properties.browserFamily = {
|
|
309
347
|
type: "string",
|
|
310
348
|
enum: ["chromium", "firefox"],
|
|
349
|
+
description: "Browser to open the tab in.",
|
|
311
350
|
};
|
|
312
351
|
required.push("browserFamily");
|
|
313
352
|
}
|
|
@@ -326,6 +365,8 @@ function unsafeArgsProperty() {
|
|
|
326
365
|
items: {
|
|
327
366
|
type: "string",
|
|
328
367
|
},
|
|
368
|
+
description:
|
|
369
|
+
"Extra browser command-line flags, each starting with -. Flags that conflict with broker-managed launch options (debugging port, address, profile) are rejected.",
|
|
329
370
|
};
|
|
330
371
|
}
|
|
331
372
|
|
|
@@ -333,27 +374,40 @@ function launchBrowserInputSchema(browserFamily, enableUnsafeLaunchArgs) {
|
|
|
333
374
|
const properties = {
|
|
334
375
|
url: {
|
|
335
376
|
type: "string",
|
|
377
|
+
description: "URL to open in the launched browser (default about:blank).",
|
|
336
378
|
},
|
|
337
379
|
browserFamily: {
|
|
338
380
|
type: "string",
|
|
339
381
|
enum: supportedLaunchFamilies(browserFamily),
|
|
382
|
+
description:
|
|
383
|
+
"Browser to launch. Required when the broker runs in auto mode.",
|
|
340
384
|
},
|
|
341
385
|
port: {
|
|
342
386
|
type: "integer",
|
|
343
387
|
minimum: 1,
|
|
388
|
+
description:
|
|
389
|
+
"Remote debugging port to launch on (default: the port of the configured browser endpoint, usually 9222).",
|
|
344
390
|
},
|
|
345
391
|
address: {
|
|
346
392
|
type: "string",
|
|
393
|
+
description:
|
|
394
|
+
"Remote debugging bind address for Chromium and Edge (ignored for Firefox). Must be loopback unless MCP_BROWSER_ALLOW_REMOTE_ENDPOINTS=1.",
|
|
347
395
|
},
|
|
348
396
|
userDataDir: {
|
|
349
397
|
type: "string",
|
|
398
|
+
description:
|
|
399
|
+
"Browser profile directory. When omitted, Chromium and Edge get a fresh temporary profile if that browser is already running, and the default profile otherwise.",
|
|
350
400
|
},
|
|
351
401
|
waitMs: {
|
|
352
402
|
type: "integer",
|
|
353
403
|
minimum: 0,
|
|
404
|
+
description:
|
|
405
|
+
"How long to wait for the debugging endpoint to answer after launch (default 5000).",
|
|
354
406
|
},
|
|
355
407
|
skipDoctor: {
|
|
356
408
|
type: "boolean",
|
|
409
|
+
description:
|
|
410
|
+
"Return right after spawning the browser, without waiting for the endpoint or running the doctor report (default false).",
|
|
357
411
|
},
|
|
358
412
|
};
|
|
359
413
|
if (enableUnsafeLaunchArgs) {
|
|
@@ -374,32 +428,49 @@ function ensureBrowserInputSchema(browserFamily, enableUnsafeLaunchArgs) {
|
|
|
374
428
|
browserFamily: {
|
|
375
429
|
type: "string",
|
|
376
430
|
enum: supportedLaunchFamilies(browserFamily),
|
|
431
|
+
description:
|
|
432
|
+
"Browser to check or launch. Required when the broker runs in auto mode.",
|
|
377
433
|
},
|
|
378
434
|
url: {
|
|
379
435
|
type: "string",
|
|
436
|
+
description: "URL to open in a new tab once the browser is reachable.",
|
|
380
437
|
},
|
|
381
438
|
createTab: {
|
|
382
439
|
type: "boolean",
|
|
440
|
+
description:
|
|
441
|
+
"Open a tab after the browser is reachable (default: true when url is given).",
|
|
383
442
|
},
|
|
384
443
|
launchIfMissing: {
|
|
385
444
|
type: "boolean",
|
|
445
|
+
description:
|
|
446
|
+
"Launch a browser when none is reachable (default true). When false and none is reachable, return the status without launching or opening a tab.",
|
|
386
447
|
},
|
|
387
448
|
port: {
|
|
388
449
|
type: "integer",
|
|
389
450
|
minimum: 1,
|
|
451
|
+
description:
|
|
452
|
+
"Remote debugging port to launch on (default: the port of the configured browser endpoint, usually 9222).",
|
|
390
453
|
},
|
|
391
454
|
address: {
|
|
392
455
|
type: "string",
|
|
456
|
+
description:
|
|
457
|
+
"Remote debugging bind address for Chromium and Edge (ignored for Firefox). Must be loopback unless MCP_BROWSER_ALLOW_REMOTE_ENDPOINTS=1.",
|
|
393
458
|
},
|
|
394
459
|
userDataDir: {
|
|
395
460
|
type: "string",
|
|
461
|
+
description:
|
|
462
|
+
"Browser profile directory. When omitted, Chromium and Edge get a fresh temporary profile if that browser is already running, and the default profile otherwise.",
|
|
396
463
|
},
|
|
397
464
|
waitMs: {
|
|
398
465
|
type: "integer",
|
|
399
466
|
minimum: 0,
|
|
467
|
+
description:
|
|
468
|
+
"How long to wait for the debugging endpoint to answer after launch (default 5000).",
|
|
400
469
|
},
|
|
401
470
|
skipDoctor: {
|
|
402
471
|
type: "boolean",
|
|
472
|
+
description:
|
|
473
|
+
"Return right after spawning the browser, without waiting for the endpoint or running the doctor report (default false).",
|
|
403
474
|
},
|
|
404
475
|
};
|
|
405
476
|
if (enableUnsafeLaunchArgs) {
|
|
@@ -684,6 +755,7 @@ export class McpBrowserDevToolsServer {
|
|
|
684
755
|
properties: {
|
|
685
756
|
targetId: {
|
|
686
757
|
type: "string",
|
|
758
|
+
description: "Target id returned by list_tabs or new_tab.",
|
|
687
759
|
},
|
|
688
760
|
},
|
|
689
761
|
required: ["targetId"],
|
|
@@ -802,9 +874,7 @@ export class McpBrowserDevToolsServer {
|
|
|
802
874
|
"Compare a selector across two attached sessions using a bounded element summary.",
|
|
803
875
|
inputSchema: compareSessionsSchema(
|
|
804
876
|
{
|
|
805
|
-
selector:
|
|
806
|
-
type: "string",
|
|
807
|
-
},
|
|
877
|
+
selector: selectorProperty(),
|
|
808
878
|
},
|
|
809
879
|
["selector"],
|
|
810
880
|
),
|
|
@@ -863,7 +933,7 @@ export class McpBrowserDevToolsServer {
|
|
|
863
933
|
definition: {
|
|
864
934
|
name: "wait_for",
|
|
865
935
|
description:
|
|
866
|
-
"Wait
|
|
936
|
+
"Wait until every given condition holds on an attached session: selector state, exact url, urlIncludes substring, and readyState. Give at least one condition. Polls until the conditions match or timeoutMs passes, then fails with the last observed state. A selector check scrolls the matched element into view on each poll.",
|
|
867
937
|
inputSchema: waitForInputSchema(),
|
|
868
938
|
},
|
|
869
939
|
handler: async (args) => {
|
|
@@ -1025,6 +1095,7 @@ export class McpBrowserDevToolsServer {
|
|
|
1025
1095
|
{
|
|
1026
1096
|
url: {
|
|
1027
1097
|
type: "string",
|
|
1098
|
+
description: "Absolute URL to load.",
|
|
1028
1099
|
},
|
|
1029
1100
|
waitUntil: waitUntilProperty(),
|
|
1030
1101
|
},
|
|
@@ -1048,6 +1119,8 @@ export class McpBrowserDevToolsServer {
|
|
|
1048
1119
|
{
|
|
1049
1120
|
ignoreCache: {
|
|
1050
1121
|
type: "boolean",
|
|
1122
|
+
description:
|
|
1123
|
+
"Bypass the HTTP cache for this reload (default false).",
|
|
1051
1124
|
},
|
|
1052
1125
|
waitUntil: waitUntilProperty(),
|
|
1053
1126
|
},
|
|
@@ -1067,12 +1140,10 @@ export class McpBrowserDevToolsServer {
|
|
|
1067
1140
|
definition: {
|
|
1068
1141
|
name: "click",
|
|
1069
1142
|
description:
|
|
1070
|
-
"Click a single element located by CSS, text=..., role=..., or name=... syntax.",
|
|
1143
|
+
"Click a single element located by CSS, text=..., role=..., or name=... syntax. Sends real mouse input at the element center and fails if another element covers that point. A JavaScript alert or confirm dialog that this opens is accepted automatically and a prompt is dismissed; get_events reports it as a dialog event.",
|
|
1071
1144
|
inputSchema: sessionSchema(
|
|
1072
1145
|
{
|
|
1073
|
-
selector:
|
|
1074
|
-
type: "string",
|
|
1075
|
-
},
|
|
1146
|
+
selector: selectorProperty(),
|
|
1076
1147
|
},
|
|
1077
1148
|
["selector"],
|
|
1078
1149
|
),
|
|
@@ -1087,12 +1158,10 @@ export class McpBrowserDevToolsServer {
|
|
|
1087
1158
|
definition: {
|
|
1088
1159
|
name: "hover",
|
|
1089
1160
|
description:
|
|
1090
|
-
"Hover a single element located by CSS, text=..., role=..., or name=... syntax.",
|
|
1161
|
+
"Hover a single element located by CSS, text=..., role=..., or name=... syntax. Moves the real mouse pointer to the element center.",
|
|
1091
1162
|
inputSchema: sessionSchema(
|
|
1092
1163
|
{
|
|
1093
|
-
selector:
|
|
1094
|
-
type: "string",
|
|
1095
|
-
},
|
|
1164
|
+
selector: selectorProperty(),
|
|
1096
1165
|
},
|
|
1097
1166
|
["selector"],
|
|
1098
1167
|
),
|
|
@@ -1107,17 +1176,19 @@ export class McpBrowserDevToolsServer {
|
|
|
1107
1176
|
definition: {
|
|
1108
1177
|
name: "type",
|
|
1109
1178
|
description:
|
|
1110
|
-
"Type text into an input, textarea, or contenteditable element.",
|
|
1179
|
+
"Type text into an input, textarea, or contenteditable element using real text input, replacing existing content unless clear is false.",
|
|
1111
1180
|
inputSchema: sessionSchema(
|
|
1112
1181
|
{
|
|
1113
|
-
selector:
|
|
1114
|
-
type: "string",
|
|
1115
|
-
},
|
|
1182
|
+
selector: selectorProperty(),
|
|
1116
1183
|
text: {
|
|
1117
1184
|
type: "string",
|
|
1185
|
+
description:
|
|
1186
|
+
"Text to enter. Each newline is sent as an Enter key press: a line break in a textarea, implicit form submission in a single-line input. Date, time, datetime-local, month, week, color, and range inputs get the value set directly, so pass it in that input's value format (for example 2026-09-27). An empty string with clear empties the field.",
|
|
1118
1187
|
},
|
|
1119
1188
|
clear: {
|
|
1120
1189
|
type: "boolean",
|
|
1190
|
+
description:
|
|
1191
|
+
"Replace the existing content (default true). When false, the text is inserted at the end of the current content. Ignored for date, time, datetime-local, month, week, color, and range inputs, whose value is always replaced.",
|
|
1121
1192
|
},
|
|
1122
1193
|
},
|
|
1123
1194
|
["selector", "text"],
|
|
@@ -1135,17 +1206,19 @@ export class McpBrowserDevToolsServer {
|
|
|
1135
1206
|
definition: {
|
|
1136
1207
|
name: "select",
|
|
1137
1208
|
description:
|
|
1138
|
-
"Select an option
|
|
1209
|
+
"Select an option in a native <select> element and fire input and change events. Provide value, label, or both; the first option matching either is selected, and the call fails if none matches. Custom dropdowns built from other elements need click instead.",
|
|
1139
1210
|
inputSchema: sessionSchema(
|
|
1140
1211
|
{
|
|
1141
|
-
selector:
|
|
1142
|
-
type: "string",
|
|
1143
|
-
},
|
|
1212
|
+
selector: selectorProperty(),
|
|
1144
1213
|
value: {
|
|
1145
1214
|
type: "string",
|
|
1215
|
+
description:
|
|
1216
|
+
"Matches an option whose value attribute or full text equals this string.",
|
|
1146
1217
|
},
|
|
1147
1218
|
label: {
|
|
1148
1219
|
type: "string",
|
|
1220
|
+
description:
|
|
1221
|
+
"Matches an option whose visible text contains this string (case-sensitive).",
|
|
1149
1222
|
},
|
|
1150
1223
|
},
|
|
1151
1224
|
["selector"],
|
|
@@ -1169,15 +1242,15 @@ export class McpBrowserDevToolsServer {
|
|
|
1169
1242
|
definition: {
|
|
1170
1243
|
name: "press_key",
|
|
1171
1244
|
description:
|
|
1172
|
-
"
|
|
1245
|
+
"Press a key or key combination (for example Enter, Tab, Escape, ArrowDown, Shift+Tab, Meta+a) with real keyboard input on the focused element, or on selector after focusing it. Fails if selector cannot take focus. A JavaScript alert or confirm dialog that this opens is accepted automatically and a prompt is dismissed; get_events reports it as a dialog event.",
|
|
1173
1246
|
inputSchema: sessionSchema(
|
|
1174
1247
|
{
|
|
1175
1248
|
key: {
|
|
1176
1249
|
type: "string",
|
|
1250
|
+
description:
|
|
1251
|
+
"A single character, or a named key: Enter, Tab, Escape, Backspace, Delete, Insert, ArrowUp/Down/Left/Right, Home, End, PageUp, PageDown, Space, F1-F12, Shift, Control, Alt, or Meta. Join modifiers with + (Shift+Tab, Control+Enter, Meta+a). Names are case-insensitive; unknown names are rejected.",
|
|
1177
1252
|
},
|
|
1178
|
-
selector:
|
|
1179
|
-
type: "string",
|
|
1180
|
-
},
|
|
1253
|
+
selector: selectorProperty(),
|
|
1181
1254
|
},
|
|
1182
1255
|
["key"],
|
|
1183
1256
|
),
|
|
@@ -1199,18 +1272,22 @@ export class McpBrowserDevToolsServer {
|
|
|
1199
1272
|
"Scroll the page by deltas or scroll a specific element into view.",
|
|
1200
1273
|
inputSchema: sessionSchema(
|
|
1201
1274
|
{
|
|
1202
|
-
selector:
|
|
1203
|
-
type: "string",
|
|
1204
|
-
},
|
|
1275
|
+
selector: selectorProperty(),
|
|
1205
1276
|
deltaX: {
|
|
1206
1277
|
type: "integer",
|
|
1278
|
+
description:
|
|
1279
|
+
"Horizontal scroll distance in CSS pixels; negative scrolls left. Ignored when selector is given.",
|
|
1207
1280
|
},
|
|
1208
1281
|
deltaY: {
|
|
1209
1282
|
type: "integer",
|
|
1283
|
+
description:
|
|
1284
|
+
"Vertical scroll distance in CSS pixels; negative scrolls up. Ignored when selector is given.",
|
|
1210
1285
|
},
|
|
1211
1286
|
block: {
|
|
1212
1287
|
type: "string",
|
|
1213
1288
|
enum: ["start", "center", "end", "nearest"],
|
|
1289
|
+
description:
|
|
1290
|
+
"Vertical alignment when scrolling selector into view (default center).",
|
|
1214
1291
|
},
|
|
1215
1292
|
},
|
|
1216
1293
|
[],
|
|
@@ -1248,17 +1325,23 @@ export class McpBrowserDevToolsServer {
|
|
|
1248
1325
|
width: {
|
|
1249
1326
|
type: "integer",
|
|
1250
1327
|
minimum: 1,
|
|
1328
|
+
description: "Viewport width in CSS pixels.",
|
|
1251
1329
|
},
|
|
1252
1330
|
height: {
|
|
1253
1331
|
type: "integer",
|
|
1254
1332
|
minimum: 1,
|
|
1333
|
+
description: "Viewport height in CSS pixels.",
|
|
1255
1334
|
},
|
|
1256
1335
|
deviceScaleFactor: {
|
|
1257
1336
|
type: "number",
|
|
1258
1337
|
minimum: 0.1,
|
|
1338
|
+
description:
|
|
1339
|
+
"Device pixel ratio to emulate. Chromium and Edge use 1 when omitted; Firefox keeps its current ratio.",
|
|
1259
1340
|
},
|
|
1260
1341
|
mobile: {
|
|
1261
1342
|
type: "boolean",
|
|
1343
|
+
description:
|
|
1344
|
+
"Emulate a mobile device, including meta viewport handling (default false). Chromium and Edge only; ignored on Firefox.",
|
|
1262
1345
|
},
|
|
1263
1346
|
},
|
|
1264
1347
|
["width", "height"],
|
|
@@ -1318,10 +1401,13 @@ export class McpBrowserDevToolsServer {
|
|
|
1318
1401
|
properties: {
|
|
1319
1402
|
sessionId: {
|
|
1320
1403
|
type: "string",
|
|
1404
|
+
description: "Session id returned by attach_tab.",
|
|
1321
1405
|
},
|
|
1322
1406
|
depth: {
|
|
1323
1407
|
type: "integer",
|
|
1324
1408
|
minimum: 1,
|
|
1409
|
+
description:
|
|
1410
|
+
"How many levels of child nodes to include (default 2). Chromium and Edge only; Firefox returns the full document HTML regardless.",
|
|
1325
1411
|
},
|
|
1326
1412
|
},
|
|
1327
1413
|
required: ["sessionId"],
|
|
@@ -1338,16 +1424,15 @@ export class McpBrowserDevToolsServer {
|
|
|
1338
1424
|
definition: {
|
|
1339
1425
|
name: "inspect_element",
|
|
1340
1426
|
description:
|
|
1341
|
-
"Inspect a single DOM element located by CSS, text=..., role=..., or name=... syntax and return normalized element details.",
|
|
1427
|
+
"Inspect a single DOM element located by CSS, text=..., role=..., or name=... syntax and return normalized element details. Scrolls the element into view first, so the returned box reflects the scrolled position.",
|
|
1342
1428
|
inputSchema: {
|
|
1343
1429
|
type: "object",
|
|
1344
1430
|
properties: {
|
|
1345
1431
|
sessionId: {
|
|
1346
1432
|
type: "string",
|
|
1433
|
+
description: "Session id returned by attach_tab.",
|
|
1347
1434
|
},
|
|
1348
|
-
selector:
|
|
1349
|
-
type: "string",
|
|
1350
|
-
},
|
|
1435
|
+
selector: selectorProperty(),
|
|
1351
1436
|
},
|
|
1352
1437
|
required: ["sessionId", "selector"],
|
|
1353
1438
|
additionalProperties: false,
|
|
@@ -1369,14 +1454,14 @@ export class McpBrowserDevToolsServer {
|
|
|
1369
1454
|
properties: {
|
|
1370
1455
|
sessionId: {
|
|
1371
1456
|
type: "string",
|
|
1457
|
+
description: "Session id returned by attach_tab.",
|
|
1372
1458
|
},
|
|
1373
1459
|
format: {
|
|
1374
1460
|
type: "string",
|
|
1375
1461
|
enum: screenshotFormatsFor(this.config.browserFamily),
|
|
1462
|
+
description: "Image format (default png).",
|
|
1376
1463
|
},
|
|
1377
|
-
selector:
|
|
1378
|
-
type: "string",
|
|
1379
|
-
},
|
|
1464
|
+
selector: selectorProperty(),
|
|
1380
1465
|
},
|
|
1381
1466
|
required: ["sessionId"],
|
|
1382
1467
|
additionalProperties: false,
|
|
@@ -1404,10 +1489,13 @@ export class McpBrowserDevToolsServer {
|
|
|
1404
1489
|
properties: {
|
|
1405
1490
|
sessionId: {
|
|
1406
1491
|
type: "string",
|
|
1492
|
+
description: "Session id returned by attach_tab.",
|
|
1407
1493
|
},
|
|
1408
1494
|
limit: {
|
|
1409
1495
|
type: "integer",
|
|
1410
1496
|
minimum: 1,
|
|
1497
|
+
description:
|
|
1498
|
+
"Return the most recent N events from the session buffer (default 50).",
|
|
1411
1499
|
},
|
|
1412
1500
|
},
|
|
1413
1501
|
required: ["sessionId"],
|
|
@@ -1436,15 +1524,22 @@ export class McpBrowserDevToolsServer {
|
|
|
1436
1524
|
properties: {
|
|
1437
1525
|
sessionId: {
|
|
1438
1526
|
type: "string",
|
|
1527
|
+
description: "Session id returned by attach_tab.",
|
|
1439
1528
|
},
|
|
1440
1529
|
expression: {
|
|
1441
1530
|
type: "string",
|
|
1531
|
+
description:
|
|
1532
|
+
"JavaScript expression to evaluate in the page's main world.",
|
|
1442
1533
|
},
|
|
1443
1534
|
awaitPromise: {
|
|
1444
1535
|
type: "boolean",
|
|
1536
|
+
description:
|
|
1537
|
+
"Wait for a returned promise to settle and return its result (default true).",
|
|
1445
1538
|
},
|
|
1446
1539
|
returnByValue: {
|
|
1447
1540
|
type: "boolean",
|
|
1541
|
+
description:
|
|
1542
|
+
"Return the result as a JSON value (default true). When false, only a short description of the resulting object is returned. Chromium and Edge only; Firefox always returns a serialized value.",
|
|
1448
1543
|
},
|
|
1449
1544
|
},
|
|
1450
1545
|
required: ["sessionId", "expression"],
|