Skip to content

Commit 7d59313

Browse files
committed
refactor: rename --experimental-page-id-routing to --page-id-routing
Per reviewer feedback: drop the experimental prefix, remove hidden: true, set default to true so pageId routing is on by default. Users can opt out with --no-page-id-routing. Flag is kept as an opt-out toggle in case token overhead is unacceptable or routing does not work as expected.
1 parent 394fbd2 commit 7d59313

5 files changed

Lines changed: 10 additions & 9 deletions

File tree

docs/tool-reference.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ so returned values have to be JSON-serializable.
352352
}`
353353

354354
- **args** (array) _(optional)_: An optional list of arguments to pass to the function.
355-
- **pageId** (number) _(optional)_: Targets a specific page by ID. Use [`list_pages`](#list_pages) to get available page IDs. If omitted, operates on the most recently selected page.
356355

357356
---
358357

src/bin/chrome-devtools-mcp-cli-options.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ export const cliOptions = {
147147
type: 'boolean',
148148
description: `If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.`,
149149
},
150-
experimentalPageIdRouting: {
150+
pageIdRouting: {
151151
type: 'boolean',
152152
describe:
153-
'(Deprecated, now always enabled) pageId is always exposed on page-scoped tools.',
154-
hidden: true,
153+
'Expose pageId on page-scoped tools and route requests by page ID. Use --no-page-id-routing to disable.',
154+
default: true,
155155
},
156156
experimentalDevtools: {
157157
type: 'boolean',

src/bin/chrome-devtools.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ delete startCliOptions.autoConnect;
4444
delete startCliOptions.viewport;
4545
// CLI is generated based on the default tool definitions. To enable conditional
4646
// tools, they need to be enabled during CLI generation.
47-
delete startCliOptions.experimentalPageIdRouting;
4847
delete startCliOptions.experimentalVision;
4948
delete startCliOptions.experimentalInteropTools;
5049
delete startCliOptions.experimentalScreencast;

src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ export async function createMcpServer(
165165
return;
166166
}
167167
const schema =
168-
'pageScoped' in tool && tool.pageScoped && !serverArgs.slim
168+
'pageScoped' in tool &&
169+
tool.pageScoped &&
170+
serverArgs.pageIdRouting &&
171+
!serverArgs.slim
169172
? {...tool.schema, ...pageIdSchema}
170173
: tool.schema;
171174

@@ -190,7 +193,7 @@ export async function createMcpServer(
190193
: new McpResponse(serverArgs);
191194
if ('pageScoped' in tool && tool.pageScoped) {
192195
const page =
193-
params.pageId && !serverArgs.slim
196+
serverArgs.pageIdRouting && params.pageId && !serverArgs.slim
194197
? context.getPageById(params.pageId)
195198
: context.getSelectedMcpPage();
196199
response.setPage(page);

src/tools/script.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Example with arguments: \`(el) => {
4646
)
4747
.optional()
4848
.describe(`An optional list of arguments to pass to the function.`),
49-
...pageIdSchema,
49+
...(cliArgs?.pageIdRouting ? pageIdSchema : {}),
5050
...(cliArgs?.categoryExtensions
5151
? {
5252
serviceWorkerId: zod
@@ -81,7 +81,7 @@ Example with arguments: \`(el) => {
8181
return;
8282
}
8383

84-
const mcpPage = request.params.pageId
84+
const mcpPage = cliArgs?.pageIdRouting
8585
? context.getPageById(request.params.pageId)
8686
: context.getSelectedMcpPage();
8787
const page: Page = mcpPage.pptrPage;

0 commit comments

Comments
 (0)