Skip to content

Commit e6f143b

Browse files
author
Samiya Caur
committed
fix(cli): have pageId as first argument
1 parent 2eab509 commit e6f143b

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

skills/chrome-devtools-cli/SKILL.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ chrome-devtools performance_start_trace true false # Starts a performance trace
8888
chrome-devtools performance_start_trace true true --filePath t.gz # Start trace and save to a file
8989
chrome-devtools performance_stop_trace # Stops the active performance trace
9090
chrome-devtools performance_stop_trace --filePath "t.json" # Stop trace and save to a file
91-
chrome-devtools take_memory_snapshot "./snap.heapsnapshot" # Capture a memory heapsnapshot
91+
chrome-devtools take_heapsnapshot "./snap.heapsnapshot" # Capture a memory heapsnapshot
9292
```
9393

9494
## Network
@@ -144,6 +144,22 @@ chrome-devtools screencast_stop # Stops the active screencast
144144
chrome-devtools list_webmcp_tools # List all WebMCP tools (requires --categoryExperimentalWebmcp=true)
145145
```
146146

147+
### Page ID Routing
148+
149+
When enabled, **all page-scoped tools** require the `pageId` (obtained from `list_pages` or `new_page`) as their **first positional argument**.
150+
151+
Example syntax changes when `--experimentalPageIdRouting` is enabled:
152+
153+
```bash
154+
# Default (without flag):
155+
chrome-devtools click "uid"
156+
chrome-devtools take_snapshot
157+
158+
# With --experimentalPageIdRouting:
159+
chrome-devtools click <pageId> "uid"
160+
chrome-devtools take_snapshot <pageId>
161+
```
162+
147163
## Service Management
148164

149165
```bash

src/ToolHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export class ToolHandler {
163163
tool.pageScoped &&
164164
serverArgs.experimentalPageIdRouting &&
165165
!serverArgs.slim
166-
? {...tool.schema, ...pageIdSchema}
166+
? {...pageIdSchema, ...tool.schema}
167167
: tool.schema;
168168
this.registeredInputSchema = zod.object(this.inputSchema).passthrough();
169169
}

src/tools/script.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ so returned values have to be JSON-serializable.`,
2424
readOnlyHint: false,
2525
},
2626
schema: {
27+
...(cliArgs?.experimentalPageIdRouting ? pageIdSchema : {}),
2728
function: zod.string().describe(
2829
`A JavaScript function declaration to be executed by the tool in the currently selected page.
2930
Example without arguments: \`() => {
@@ -58,7 +59,6 @@ Example with arguments: \`(el) => {
5859
.describe(
5960
'Handle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept.',
6061
),
61-
...(cliArgs?.experimentalPageIdRouting ? pageIdSchema : {}),
6262
...(cliArgs?.categoryExtensions
6363
? {
6464
serviceWorkerId: zod

0 commit comments

Comments
 (0)