mcp-browser-dev-tools 0.1.0 → 0.2.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 +116 -347
- package/package.json +16 -2
- package/src/action-retry.mjs +50 -0
- package/src/browser-adapter.mjs +15 -4
- package/src/browser-requests.mjs +15 -0
- package/src/cdp-client.mjs +104 -10
- package/src/firefox-bidi-client.mjs +26 -3
- package/src/json-schema.mjs +99 -0
- package/src/mcp-server.mjs +35 -2014
- package/src/page-context.mjs +25 -1034
- package/src/page-script.mjs +1372 -0
- package/src/run-steps.mjs +510 -0
- package/src/run-tabs.mjs +291 -0
- package/src/screenshot-output.mjs +141 -0
- package/src/tool-results.mjs +34 -0
- package/src/tool-schemas.mjs +449 -0
- package/src/tools/action-tools.mjs +318 -0
- package/src/tools/browser-tools.mjs +221 -0
- package/src/tools/inspection-tools.mjs +287 -0
- package/src/tools/state-tools.mjs +327 -0
- package/src/top-level-await.mjs +260 -0
- package/src/wait-for.mjs +381 -71
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { retryUntilActionable } from "../action-retry.mjs";
|
|
2
|
+
import { parseKeyCombo } from "../keyboard.mjs";
|
|
3
|
+
import {
|
|
4
|
+
actionTimeoutProperty,
|
|
5
|
+
selectorProperty,
|
|
6
|
+
sessionSchema,
|
|
7
|
+
waitUntilProperty,
|
|
8
|
+
} from "../tool-schemas.mjs";
|
|
9
|
+
|
|
10
|
+
export function actionTools(server) {
|
|
11
|
+
return [
|
|
12
|
+
[
|
|
13
|
+
"navigate",
|
|
14
|
+
{
|
|
15
|
+
definition: {
|
|
16
|
+
name: "navigate",
|
|
17
|
+
description:
|
|
18
|
+
"Navigate an attached tab to a URL and optionally wait for interactive or complete load state.",
|
|
19
|
+
inputSchema: sessionSchema(
|
|
20
|
+
{
|
|
21
|
+
url: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: "Absolute URL to load.",
|
|
24
|
+
},
|
|
25
|
+
waitUntil: waitUntilProperty(),
|
|
26
|
+
},
|
|
27
|
+
["url"],
|
|
28
|
+
),
|
|
29
|
+
},
|
|
30
|
+
handler: async (args) =>
|
|
31
|
+
server.browserAdapter.navigate(args.sessionId, args.url, {
|
|
32
|
+
waitUntil: args.waitUntil,
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
"reload",
|
|
38
|
+
{
|
|
39
|
+
definition: {
|
|
40
|
+
name: "reload",
|
|
41
|
+
description:
|
|
42
|
+
"Reload the attached tab and optionally ignore cache while waiting for interactive or complete load state.",
|
|
43
|
+
inputSchema: sessionSchema(
|
|
44
|
+
{
|
|
45
|
+
ignoreCache: {
|
|
46
|
+
type: "boolean",
|
|
47
|
+
description:
|
|
48
|
+
"Bypass the HTTP cache for this reload (default false).",
|
|
49
|
+
},
|
|
50
|
+
waitUntil: waitUntilProperty(),
|
|
51
|
+
},
|
|
52
|
+
[],
|
|
53
|
+
),
|
|
54
|
+
},
|
|
55
|
+
handler: async (args) =>
|
|
56
|
+
server.browserAdapter.reload(args.sessionId, {
|
|
57
|
+
ignoreCache: args.ignoreCache,
|
|
58
|
+
waitUntil: args.waitUntil,
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"click",
|
|
64
|
+
{
|
|
65
|
+
definition: {
|
|
66
|
+
name: "click",
|
|
67
|
+
description:
|
|
68
|
+
"Click an element with real mouse input at its center; fails if another element covers that point. Accepts an alert or confirm dialog it opens and dismisses a prompt (get_events reports it). Check the result in the same call with run_steps.",
|
|
69
|
+
inputSchema: sessionSchema(
|
|
70
|
+
{
|
|
71
|
+
selector: selectorProperty(),
|
|
72
|
+
timeoutMs: actionTimeoutProperty(
|
|
73
|
+
", covered, outside the viewport, or disabled",
|
|
74
|
+
),
|
|
75
|
+
},
|
|
76
|
+
["selector"],
|
|
77
|
+
),
|
|
78
|
+
},
|
|
79
|
+
handler: async (args) =>
|
|
80
|
+
retryUntilActionable(
|
|
81
|
+
() => server.browserAdapter.click(args.sessionId, args.selector),
|
|
82
|
+
args.timeoutMs,
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
"hover",
|
|
88
|
+
{
|
|
89
|
+
definition: {
|
|
90
|
+
name: "hover",
|
|
91
|
+
description:
|
|
92
|
+
"Hover a single element located by CSS, text=..., role=..., or name=... syntax. Moves the real mouse pointer to the element center.",
|
|
93
|
+
inputSchema: sessionSchema(
|
|
94
|
+
{
|
|
95
|
+
selector: selectorProperty(),
|
|
96
|
+
timeoutMs: actionTimeoutProperty(
|
|
97
|
+
", covered, or outside the viewport",
|
|
98
|
+
),
|
|
99
|
+
},
|
|
100
|
+
["selector"],
|
|
101
|
+
),
|
|
102
|
+
},
|
|
103
|
+
handler: async (args) =>
|
|
104
|
+
retryUntilActionable(
|
|
105
|
+
() => server.browserAdapter.hover(args.sessionId, args.selector),
|
|
106
|
+
args.timeoutMs,
|
|
107
|
+
),
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
"type",
|
|
112
|
+
{
|
|
113
|
+
definition: {
|
|
114
|
+
name: "type",
|
|
115
|
+
description:
|
|
116
|
+
"Type into an input, textarea, or contenteditable with real text input, replacing its content unless clear is false. Check the result in the same call with run_steps.",
|
|
117
|
+
inputSchema: sessionSchema(
|
|
118
|
+
{
|
|
119
|
+
selector: selectorProperty(),
|
|
120
|
+
text: {
|
|
121
|
+
type: "string",
|
|
122
|
+
description:
|
|
123
|
+
"Text to enter; each newline is an Enter press (a line break in a textarea, form submission in a single-line input). Date, time, datetime-local, month, week, color, and range inputs get the value set directly, in their value format (for example 2026-09-27). An empty string with clear empties the field.",
|
|
124
|
+
},
|
|
125
|
+
clear: {
|
|
126
|
+
type: "boolean",
|
|
127
|
+
description:
|
|
128
|
+
"Replace the existing content (default true); false inserts at the end. The picker inputs listed under text are always replaced.",
|
|
129
|
+
},
|
|
130
|
+
timeoutMs: actionTimeoutProperty(""),
|
|
131
|
+
},
|
|
132
|
+
["selector", "text"],
|
|
133
|
+
),
|
|
134
|
+
},
|
|
135
|
+
handler: async (args) =>
|
|
136
|
+
retryUntilActionable(
|
|
137
|
+
() =>
|
|
138
|
+
server.browserAdapter.type(
|
|
139
|
+
args.sessionId,
|
|
140
|
+
args.selector,
|
|
141
|
+
args.text,
|
|
142
|
+
{ clear: args.clear },
|
|
143
|
+
),
|
|
144
|
+
args.timeoutMs,
|
|
145
|
+
),
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
[
|
|
149
|
+
"select",
|
|
150
|
+
{
|
|
151
|
+
definition: {
|
|
152
|
+
name: "select",
|
|
153
|
+
description:
|
|
154
|
+
"Select an option in a native <select> by value or label (the first option matching either) and fire input and change events; fails if none matches. Use click for custom dropdowns. Check the result in the same call with run_steps.",
|
|
155
|
+
inputSchema: sessionSchema(
|
|
156
|
+
{
|
|
157
|
+
selector: selectorProperty(),
|
|
158
|
+
value: {
|
|
159
|
+
type: "string",
|
|
160
|
+
description:
|
|
161
|
+
"Matches an option whose value attribute or full text equals this string.",
|
|
162
|
+
},
|
|
163
|
+
label: {
|
|
164
|
+
type: "string",
|
|
165
|
+
description:
|
|
166
|
+
"Matches an option whose visible text contains this string (case-sensitive).",
|
|
167
|
+
},
|
|
168
|
+
timeoutMs: actionTimeoutProperty(""),
|
|
169
|
+
},
|
|
170
|
+
["selector"],
|
|
171
|
+
),
|
|
172
|
+
},
|
|
173
|
+
validate: (args) => {
|
|
174
|
+
if (!args.value && !args.label) {
|
|
175
|
+
throw new Error("select requires either value or label");
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
handler: async (args) =>
|
|
179
|
+
retryUntilActionable(
|
|
180
|
+
() =>
|
|
181
|
+
server.browserAdapter.select(args.sessionId, args.selector, {
|
|
182
|
+
value: args.value,
|
|
183
|
+
label: args.label,
|
|
184
|
+
}),
|
|
185
|
+
args.timeoutMs,
|
|
186
|
+
),
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
[
|
|
190
|
+
"press_key",
|
|
191
|
+
{
|
|
192
|
+
definition: {
|
|
193
|
+
name: "press_key",
|
|
194
|
+
description:
|
|
195
|
+
"Press a key or combination with real keyboard input on the focused element, or on selector after focusing it (fails if it cannot take focus). Accepts an alert or confirm dialog it opens and dismisses a prompt (get_events reports it). Check the result in the same call with run_steps.",
|
|
196
|
+
inputSchema: sessionSchema(
|
|
197
|
+
{
|
|
198
|
+
key: {
|
|
199
|
+
type: "string",
|
|
200
|
+
description:
|
|
201
|
+
"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.",
|
|
202
|
+
},
|
|
203
|
+
selector: selectorProperty(),
|
|
204
|
+
timeoutMs: actionTimeoutProperty("; only applies with selector"),
|
|
205
|
+
},
|
|
206
|
+
["key"],
|
|
207
|
+
),
|
|
208
|
+
},
|
|
209
|
+
validate: (args) => {
|
|
210
|
+
parseKeyCombo(args.key);
|
|
211
|
+
},
|
|
212
|
+
handler: async (args) =>
|
|
213
|
+
retryUntilActionable(
|
|
214
|
+
() =>
|
|
215
|
+
server.browserAdapter.pressKey(
|
|
216
|
+
args.sessionId,
|
|
217
|
+
args.key,
|
|
218
|
+
args.selector,
|
|
219
|
+
),
|
|
220
|
+
args.selector ? args.timeoutMs : 0,
|
|
221
|
+
),
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
[
|
|
225
|
+
"scroll",
|
|
226
|
+
{
|
|
227
|
+
definition: {
|
|
228
|
+
name: "scroll",
|
|
229
|
+
description:
|
|
230
|
+
"Scroll the page by deltas or scroll a specific element into view.",
|
|
231
|
+
inputSchema: sessionSchema(
|
|
232
|
+
{
|
|
233
|
+
selector: selectorProperty(),
|
|
234
|
+
deltaX: {
|
|
235
|
+
type: "integer",
|
|
236
|
+
description:
|
|
237
|
+
"Horizontal scroll distance in CSS pixels; negative scrolls left. Ignored when selector is given.",
|
|
238
|
+
},
|
|
239
|
+
deltaY: {
|
|
240
|
+
type: "integer",
|
|
241
|
+
description:
|
|
242
|
+
"Vertical scroll distance in CSS pixels; negative scrolls up. Ignored when selector is given.",
|
|
243
|
+
},
|
|
244
|
+
block: {
|
|
245
|
+
type: "string",
|
|
246
|
+
enum: ["start", "center", "end", "nearest"],
|
|
247
|
+
description:
|
|
248
|
+
"Vertical alignment when scrolling selector into view (default center).",
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
[],
|
|
252
|
+
),
|
|
253
|
+
},
|
|
254
|
+
validate: (args) => {
|
|
255
|
+
if (
|
|
256
|
+
!args.selector &&
|
|
257
|
+
args.deltaX === undefined &&
|
|
258
|
+
args.deltaY === undefined
|
|
259
|
+
) {
|
|
260
|
+
throw new Error(
|
|
261
|
+
"scroll requires either selector or deltaX/deltaY values",
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
handler: async (args) =>
|
|
266
|
+
server.browserAdapter.scroll(args.sessionId, {
|
|
267
|
+
selector: args.selector,
|
|
268
|
+
deltaX: args.deltaX,
|
|
269
|
+
deltaY: args.deltaY,
|
|
270
|
+
block: args.block,
|
|
271
|
+
}),
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
[
|
|
275
|
+
"set_viewport",
|
|
276
|
+
{
|
|
277
|
+
definition: {
|
|
278
|
+
name: "set_viewport",
|
|
279
|
+
description:
|
|
280
|
+
"Override the page viewport to a specific width and height for responsive debugging.",
|
|
281
|
+
inputSchema: sessionSchema(
|
|
282
|
+
{
|
|
283
|
+
width: {
|
|
284
|
+
type: "integer",
|
|
285
|
+
minimum: 1,
|
|
286
|
+
description: "Viewport width in CSS pixels.",
|
|
287
|
+
},
|
|
288
|
+
height: {
|
|
289
|
+
type: "integer",
|
|
290
|
+
minimum: 1,
|
|
291
|
+
description: "Viewport height in CSS pixels.",
|
|
292
|
+
},
|
|
293
|
+
deviceScaleFactor: {
|
|
294
|
+
type: "number",
|
|
295
|
+
minimum: 0.1,
|
|
296
|
+
description:
|
|
297
|
+
"Device pixel ratio to emulate. Chromium and Edge use 1 when omitted; Firefox keeps its current ratio.",
|
|
298
|
+
},
|
|
299
|
+
mobile: {
|
|
300
|
+
type: "boolean",
|
|
301
|
+
description:
|
|
302
|
+
"Emulate a mobile device, including meta viewport handling (default false). Chromium and Edge only; ignored on Firefox.",
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
["width", "height"],
|
|
306
|
+
),
|
|
307
|
+
},
|
|
308
|
+
handler: async (args) =>
|
|
309
|
+
server.browserAdapter.setViewport(args.sessionId, {
|
|
310
|
+
width: args.width,
|
|
311
|
+
height: args.height,
|
|
312
|
+
deviceScaleFactor: args.deviceScaleFactor,
|
|
313
|
+
mobile: args.mobile,
|
|
314
|
+
}),
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
];
|
|
318
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import {
|
|
2
|
+
requestedBrowserFamily,
|
|
3
|
+
shouldCreateBrowserTab,
|
|
4
|
+
} from "../browser-requests.mjs";
|
|
5
|
+
import { PACKAGE_NAME, PACKAGE_VERSION } from "../package-info.mjs";
|
|
6
|
+
import {
|
|
7
|
+
emptyObjectSchema,
|
|
8
|
+
ensureBrowserInputSchema,
|
|
9
|
+
launchBrowserInputSchema,
|
|
10
|
+
newTabInputSchema,
|
|
11
|
+
} from "../tool-schemas.mjs";
|
|
12
|
+
|
|
13
|
+
const SERVER_NAME = PACKAGE_NAME;
|
|
14
|
+
const SERVER_VERSION = PACKAGE_VERSION;
|
|
15
|
+
|
|
16
|
+
export function browserTools(server) {
|
|
17
|
+
return [
|
|
18
|
+
[
|
|
19
|
+
"browser_status",
|
|
20
|
+
{
|
|
21
|
+
definition: {
|
|
22
|
+
name: "browser_status",
|
|
23
|
+
description:
|
|
24
|
+
"Report whether the configured browser endpoint is reachable and how many active sessions are attached.",
|
|
25
|
+
inputSchema: emptyObjectSchema(),
|
|
26
|
+
},
|
|
27
|
+
handler: async () => ({
|
|
28
|
+
serverName: SERVER_NAME,
|
|
29
|
+
serverVersion: SERVER_VERSION,
|
|
30
|
+
...(await server.browserAdapter.getBrowserStatus()),
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
"list_tabs",
|
|
36
|
+
{
|
|
37
|
+
definition: {
|
|
38
|
+
name: "list_tabs",
|
|
39
|
+
description:
|
|
40
|
+
"List inspectable page targets exposed by the configured browser adapter.",
|
|
41
|
+
inputSchema: emptyObjectSchema(),
|
|
42
|
+
},
|
|
43
|
+
handler: async () => ({
|
|
44
|
+
tabs: await server.browserAdapter.listTargets(),
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
"launch_browser",
|
|
50
|
+
{
|
|
51
|
+
definition: {
|
|
52
|
+
name: "launch_browser",
|
|
53
|
+
description:
|
|
54
|
+
"Launch a local debug-enabled browser for this server's configuration and return launch details and an optional doctor report. When port, address, userDataDir, and unsafeArgs are omitted and a browser of this family is reachable, returns it with reused: true, opening url in a new tab if given. On macOS and Linux it never opens a second browser on a profile already in use. Prefer ensure_browser.",
|
|
55
|
+
inputSchema: launchBrowserInputSchema(
|
|
56
|
+
server.config.browserFamily,
|
|
57
|
+
server.config.enableUnsafeLaunchArgs,
|
|
58
|
+
),
|
|
59
|
+
},
|
|
60
|
+
handler: async (args) =>
|
|
61
|
+
server.runExclusiveLaunch(async () => {
|
|
62
|
+
const browserFamily = requestedBrowserFamily(
|
|
63
|
+
server.config.browserFamily,
|
|
64
|
+
args.browserFamily,
|
|
65
|
+
);
|
|
66
|
+
// A requested port, address, profile, or flags ask for a
|
|
67
|
+
// specific browser, so only a plain launch may reuse the
|
|
68
|
+
// running one.
|
|
69
|
+
if (
|
|
70
|
+
args.port === undefined &&
|
|
71
|
+
args.address === undefined &&
|
|
72
|
+
args.userDataDir === undefined &&
|
|
73
|
+
args.unsafeArgs === undefined
|
|
74
|
+
) {
|
|
75
|
+
const { status, available } =
|
|
76
|
+
await server.probeBrowser(browserFamily);
|
|
77
|
+
if (available) {
|
|
78
|
+
const tab = shouldCreateBrowserTab(args)
|
|
79
|
+
? await server.browserAdapter.createTab(args.url, {
|
|
80
|
+
browserFamily,
|
|
81
|
+
})
|
|
82
|
+
: null;
|
|
83
|
+
return {
|
|
84
|
+
browserFamily,
|
|
85
|
+
launched: false,
|
|
86
|
+
reused: true,
|
|
87
|
+
status,
|
|
88
|
+
tab,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return server.launchUnlessPending(browserFamily, {
|
|
94
|
+
config: server.config,
|
|
95
|
+
browserFamily: args.browserFamily,
|
|
96
|
+
url: args.url,
|
|
97
|
+
port: args.port,
|
|
98
|
+
address: args.address,
|
|
99
|
+
userDataDir: args.userDataDir,
|
|
100
|
+
unsafeArgs: args.unsafeArgs,
|
|
101
|
+
waitMs: args.waitMs,
|
|
102
|
+
skipDoctor: args.skipDoctor,
|
|
103
|
+
});
|
|
104
|
+
}),
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"ensure_browser",
|
|
109
|
+
{
|
|
110
|
+
definition: {
|
|
111
|
+
name: "ensure_browser",
|
|
112
|
+
description:
|
|
113
|
+
"Reuse a reachable browser or launch one (with the MCP_BROWSER_USER_DATA_DIR profile when set), optionally opening url in a new tab. Checks three times before launching, does not launch again for 30 seconds while a browser it launched is starting, and on macOS and Linux never opens a second browser on a profile already in use.",
|
|
114
|
+
inputSchema: ensureBrowserInputSchema(
|
|
115
|
+
server.config.browserFamily,
|
|
116
|
+
server.config.enableUnsafeLaunchArgs,
|
|
117
|
+
),
|
|
118
|
+
},
|
|
119
|
+
handler: async (args) =>
|
|
120
|
+
server.runExclusiveLaunch(() => server.ensureBrowser(args)),
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
[
|
|
124
|
+
"list_sessions",
|
|
125
|
+
{
|
|
126
|
+
definition: {
|
|
127
|
+
name: "list_sessions",
|
|
128
|
+
description:
|
|
129
|
+
"List active attached debugging sessions held by this broker.",
|
|
130
|
+
inputSchema: emptyObjectSchema(),
|
|
131
|
+
},
|
|
132
|
+
handler: async () => ({
|
|
133
|
+
sessions: server.browserAdapter.listSessions(),
|
|
134
|
+
}),
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
"new_tab",
|
|
139
|
+
{
|
|
140
|
+
definition: {
|
|
141
|
+
name: "new_tab",
|
|
142
|
+
description:
|
|
143
|
+
"Create a new browser tab and return the resulting target metadata.",
|
|
144
|
+
inputSchema: newTabInputSchema(server.config.browserFamily),
|
|
145
|
+
},
|
|
146
|
+
handler: async (args) =>
|
|
147
|
+
server.browserAdapter.createTab(args.url, {
|
|
148
|
+
browserFamily: args.browserFamily,
|
|
149
|
+
}),
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
[
|
|
153
|
+
"close_tab",
|
|
154
|
+
{
|
|
155
|
+
definition: {
|
|
156
|
+
name: "close_tab",
|
|
157
|
+
description:
|
|
158
|
+
"Close a browser tab by target id. Any attached session for that tab will disconnect.",
|
|
159
|
+
inputSchema: {
|
|
160
|
+
type: "object",
|
|
161
|
+
properties: {
|
|
162
|
+
targetId: {
|
|
163
|
+
type: "string",
|
|
164
|
+
description: "Target id returned by list_tabs or new_tab.",
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
required: ["targetId"],
|
|
168
|
+
additionalProperties: false,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
handler: async (args) =>
|
|
172
|
+
server.browserAdapter.closeTarget(args.targetId),
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
"attach_tab",
|
|
177
|
+
{
|
|
178
|
+
definition: {
|
|
179
|
+
name: "attach_tab",
|
|
180
|
+
description:
|
|
181
|
+
"Attach to a page target and start buffering console, log, and network events.",
|
|
182
|
+
inputSchema: {
|
|
183
|
+
type: "object",
|
|
184
|
+
properties: {
|
|
185
|
+
targetId: {
|
|
186
|
+
type: "string",
|
|
187
|
+
description: "The target id returned by list_tabs.",
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
required: ["targetId"],
|
|
191
|
+
additionalProperties: false,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
handler: async (args) =>
|
|
195
|
+
server.browserAdapter.attachToTarget(args.targetId),
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
[
|
|
199
|
+
"detach_tab",
|
|
200
|
+
{
|
|
201
|
+
definition: {
|
|
202
|
+
name: "detach_tab",
|
|
203
|
+
description: "Close an attached debugging session.",
|
|
204
|
+
inputSchema: {
|
|
205
|
+
type: "object",
|
|
206
|
+
properties: {
|
|
207
|
+
sessionId: {
|
|
208
|
+
type: "string",
|
|
209
|
+
description: "The session id returned by attach_tab.",
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
required: ["sessionId"],
|
|
213
|
+
additionalProperties: false,
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
handler: async (args) =>
|
|
217
|
+
server.browserAdapter.detachSession(args.sessionId),
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
];
|
|
221
|
+
}
|