You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: centralize pageId routing via pageScoped annotation and McpPage wrapper
- Add pageScoped annotation to ToolDefinition; registerTool() auto-injects
pageIdSchema and resolves the page centrally via resolvePageById()
- defineTool() wrapper guarantees request.page is always populated,
falling back to getSelectedPage() when pageId is omitted
- Remove manual ...pageIdSchema spread and resolvePageById() calls from
all 15 page-scoped tool handlers
- Introduce McpPage class consolidating per-page state (dialog, snapshot,
emulation settings, metadata) that was previously scattered across 8
Maps/WeakMaps in McpContext
- Store text snapshots per-page on McpPage so parallel agents taking
snapshots on different pages no longer clobber each other
- Cross-page uid lookup in getElementByUid()/getAXNodeByUid() searches
all McpPage instances, enabling uid resolution from any page's snapshot
- Update page_id_routing eval to test per-page snapshot isolation and
cross-page uid click resolution
-**uid** (string) **(required)**: The uid of an element on the page from the page content snapshot
72
73
-**value** (string) **(required)**: The value to [`fill`](#fill) in
73
74
-**includeSnapshot** (boolean) _(optional)_: Whether to include a snapshot in the response. Default is false.
74
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
75
75
76
76
---
77
77
@@ -83,7 +83,6 @@
83
83
84
84
-**elements** (array) **(required)**: Elements from snapshot to [`fill`](#fill) out.
85
85
-**includeSnapshot** (boolean) _(optional)_: Whether to include a snapshot in the response. Default is false.
86
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
87
86
88
87
---
89
88
@@ -117,7 +116,17 @@
117
116
118
117
-**key** (string) **(required)**: A key or a combination (e.g., "Enter", "Control+A", "Control++", "Control+Shift+R"). Modifiers: Control, Shift, Alt, Meta
119
118
-**includeSnapshot** (boolean) _(optional)_: Whether to include a snapshot in the response. Default is false.
120
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
119
+
120
+
---
121
+
122
+
### `type_text`
123
+
124
+
**Description:** Type text using keyboard into a previously focused input
125
+
126
+
**Parameters:**
127
+
128
+
-**text** (string) **(required)**: The text to type
129
+
-**submitKey** (string) _(optional)_: Optional key to press after typing. E.g., "Enter", "Tab", "Escape"
121
130
122
131
---
123
132
@@ -130,7 +139,6 @@
130
139
-**filePath** (string) **(required)**: The local path of the file to upload
131
140
-**uid** (string) **(required)**: The uid of the file input element or an element that will open file chooser on the page from the page content snapshot
132
141
-**includeSnapshot** (boolean) _(optional)_: Whether to include a snapshot in the response. Default is false.
133
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
134
142
135
143
---
136
144
@@ -163,7 +171,6 @@
163
171
-**handleBeforeUnload** (enum: "accept", "decline") _(optional)_: Whether to auto accept or beforeunload dialogs triggered by this navigation. Default is accept.
164
172
-**ignoreCache** (boolean) _(optional)_: Whether to ignore cache on reload.
165
173
-**initScript** (string) _(optional)_: A JavaScript script to be executed on each new document before any other scripts for the next navigation.
166
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
167
174
-**timeout** (integer) _(optional)_: Maximum wait time in milliseconds. If set to 0, the default timeout will be used.
168
175
-**type** (enum: "url", "back", "forward", "reload") _(optional)_: Navigate the page by URL, back or forward in history, or reload.
-**text** (array) **(required)**: Non-empty list of texts. Resolves when any value appears on the page.
204
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
205
211
-**timeout** (integer) _(optional)_: Maximum wait time in milliseconds. If set to 0, the default timeout will be used.
206
212
207
213
---
@@ -218,7 +224,6 @@
218
224
-**cpuThrottlingRate** (number) _(optional)_: Represents the CPU slowdown factor. Set the rate to 1 to disable throttling. If omitted, throttling remains unchanged.
219
225
-**geolocation** (unknown) _(optional)_: Geolocation to [`emulate`](#emulate). Set to null to clear the geolocation override.
220
226
-**networkConditions** (enum: "No emulation", "Offline", "Slow 3G", "Fast 3G", "Slow 4G", "Fast 4G") _(optional)_: Throttle network. Set to "No emulation" to disable. If omitted, conditions remain unchanged.
221
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
222
227
-**userAgent** (unknown) _(optional)_: User agent to [`emulate`](#emulate). Set to null to clear the user agent override.
223
228
-**viewport** (unknown) _(optional)_: Viewport to [`emulate`](#emulate). Set to null to reset to the default viewport.
224
229
@@ -232,7 +237,6 @@
232
237
233
238
-**height** (number) **(required)**: Page height
234
239
-**width** (number) **(required)**: Page width
235
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
236
240
237
241
---
238
242
@@ -258,7 +262,6 @@
258
262
-**autoStop** (boolean) **(required)**: Determines if the trace recording should be automatically stopped.
259
263
-**reload** (boolean) **(required)**: 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`](#navigate_page) tool BEFORE starting the trace if reload or autoStop is set to true.
260
264
-**filePath** (string) _(optional)_: 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).
261
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
262
265
263
266
---
264
267
@@ -269,7 +272,6 @@
269
272
**Parameters:**
270
273
271
274
-**filePath** (string) _(optional)_: 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).
272
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
273
275
274
276
---
275
277
@@ -330,7 +332,6 @@ so returned values have to be JSON-serializable.
330
332
}`
331
333
332
334
-**args** (array) _(optional)_: An optional list of arguments to pass to the function.
333
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
334
335
335
336
---
336
337
@@ -366,7 +367,6 @@ so returned values have to be JSON-serializable.
366
367
-**filePath** (string) _(optional)_: The absolute path, or a path relative to the current working directory, to save the screenshot to instead of attaching it to the response.
367
368
-**format** (enum: "png", "jpeg", "webp") _(optional)_: Type of format to save the screenshot as. Default is "png"
368
369
-**fullPage** (boolean) _(optional)_: If set to true takes a screenshot of the full page instead of the currently visible viewport. Incompatible with uid.
369
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
370
370
-**quality** (number) _(optional)_: Compression quality for JPEG and WebP formats (0-100). Higher values mean better quality but larger file sizes. Ignored for PNG format.
371
371
-**uid** (string) _(optional)_: The uid of an element on the page from the page content snapshot. If omitted takes a pages screenshot.
372
372
@@ -381,7 +381,6 @@ in the DevTools Elements panel (if any).
381
381
**Parameters:**
382
382
383
383
-**filePath** (string) _(optional)_: The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.
384
-
-**pageId** (number) _(optional)_: Targets a specific page by ID.
385
384
-**verbose** (boolean) _(optional)_: Whether to include all possible information available in the full a11y tree. Default is false.
0 commit comments