Skip to content

Commit f472551

Browse files
committed
perform tool renaming
1 parent 7ee5e86 commit f472551

16 files changed

Lines changed: 209 additions & 160 deletions

src/McpPage.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import type {
1313
Viewport,
1414
WebMCPTool,
1515
} from './third_party/index.js';
16-
import type {ToolGroup, ToolDefinition} from './tools/inPage.js';
1716
import {takeSnapshot} from './tools/snapshot.js';
17+
import type {ToolGroup, ToolDefinition} from './tools/thirdPartyDeveloper.js';
1818
import type {
1919
ContextPage,
2020
DevToolsData,
@@ -58,7 +58,7 @@ export class McpPage implements ContextPage {
5858
#dialog?: Dialog;
5959
#dialogHandler: (dialog: Dialog) => void;
6060

61-
inPageTools: ToolGroup<ToolDefinition> | undefined;
61+
thirdPartyDeveloperTools: ToolGroup<ToolDefinition> | undefined;
6262

6363
constructor(page: Page, id: number) {
6464
this.pptrPage = page;
@@ -89,8 +89,8 @@ export class McpPage implements ContextPage {
8989
}
9090
}
9191

92-
getInPageTools(): ToolGroup<ToolDefinition> | undefined {
93-
return this.inPageTools;
92+
getThirdPartyDeveloperTools(): ToolGroup<ToolDefinition> | undefined {
93+
return this.thirdPartyDeveloperTools;
9494
}
9595

9696
getWebMcpTools(): WebMCPTool[] {
@@ -144,7 +144,7 @@ export class McpPage implements ContextPage {
144144
this.pptrPage.off('dialog', this.#dialogHandler);
145145
}
146146

147-
async executeInPageTool(
147+
async executeThirdPartyDeveloperTool(
148148
toolName: string,
149149
params: Record<string, unknown>,
150150
response: Response,

src/McpResponse.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import type {
2727
JSONSchema7Definition,
2828
Extension,
2929
} from './third_party/index.js';
30-
import type {ToolGroup, ToolDefinition} from './tools/inPage.js';
3130
import {handleDialog} from './tools/pages.js';
31+
import type {ToolGroup, ToolDefinition} from './tools/thirdPartyDeveloper.js';
3232
import type {
3333
DevToolsData,
3434
ImageContentData,
@@ -196,7 +196,7 @@ export class McpResponse implements Response {
196196
includePreservedMessages?: boolean;
197197
};
198198
#listExtensions?: boolean;
199-
#listInPageTools?: boolean;
199+
#listThirdPartyDeveloperTools?: boolean;
200200
#listWebMcpTools?: boolean;
201201
#devToolsData?: DevToolsData;
202202
#tabId?: string;
@@ -244,9 +244,9 @@ export class McpResponse implements Response {
244244
this.#listExtensions = true;
245245
}
246246

247-
setListInPageTools(): void {
248-
if (this.#args.categoryInPageTools) {
249-
this.#listInPageTools = true;
247+
setListThirdPartyDeveloperTools(): void {
248+
if (this.#args.categoryThirdPartyDeveloperTools) {
249+
this.#listThirdPartyDeveloperTools = true;
250250
}
251251
}
252252

@@ -552,11 +552,11 @@ export class McpResponse implements Response {
552552
extensions = await context.listExtensions();
553553
}
554554

555-
let inPageTools: ToolGroup<ToolDefinition> | undefined;
556-
if (this.#listInPageTools) {
555+
let thirdPartyDeveloperTools: ToolGroup<ToolDefinition> | undefined;
556+
if (this.#listThirdPartyDeveloperTools) {
557557
const page = this.#page ?? context.getSelectedMcpPage();
558-
inPageTools = await getToolGroup(page);
559-
page.inPageTools = inPageTools;
558+
thirdPartyDeveloperTools = await getToolGroup(page);
559+
page.thirdPartyDeveloperTools = thirdPartyDeveloperTools;
560560
}
561561

562562
let webmcpTools: WebMCPTool[] | undefined;
@@ -669,7 +669,7 @@ export class McpResponse implements Response {
669669
traceSummary: this.#attachedTraceSummary,
670670
extensions,
671671
lighthouseResult: this.#attachedLighthouseResult,
672-
inPageTools,
672+
thirdPartyDeveloperTools,
673673
webmcpTools,
674674
errorMessage: this.#error?.message,
675675
});
@@ -688,7 +688,7 @@ export class McpResponse implements Response {
688688
traceInsight?: TraceInsightData;
689689
extensions?: Map<string, Extension>;
690690
lighthouseResult?: LighthouseData;
691-
inPageTools?: ToolGroup<ToolDefinition>;
691+
thirdPartyDeveloperTools?: ToolGroup<ToolDefinition>;
692692
webmcpTools?: WebMCPTool[];
693693
errorMessage?: string;
694694
},
@@ -705,7 +705,7 @@ export class McpResponse implements Response {
705705
traceInsights?: Array<{insightName: string; insightKey: string}>;
706706
lighthouseResult?: object;
707707
extensions?: object[];
708-
inPageTools?: object;
708+
thirdPartyDeveloperTools?: object;
709709
webmcpTools?: object[];
710710
message?: string;
711711
networkConditions?: string;
@@ -1004,13 +1004,17 @@ Call ${handleDialog.name} to handle it before continuing.`);
10041004
}
10051005
}
10061006

1007-
if (this.#listInPageTools) {
1008-
structuredContent.inPageTools = data.inPageTools ?? undefined;
1009-
response.push('## In-page tools');
1010-
if (!data.inPageTools || !data.inPageTools.tools) {
1011-
response.push('No in-page tools available.');
1007+
if (this.#listThirdPartyDeveloperTools) {
1008+
structuredContent.thirdPartyDeveloperTools =
1009+
data.thirdPartyDeveloperTools ?? undefined;
1010+
response.push('## Third-party developer tools');
1011+
if (
1012+
!data.thirdPartyDeveloperTools ||
1013+
!data.thirdPartyDeveloperTools.tools
1014+
) {
1015+
response.push('No third-party developer tools available.');
10121016
} else {
1013-
const toolGroup = data.inPageTools;
1017+
const toolGroup = data.thirdPartyDeveloperTools;
10141018
response.push(`${toolGroup.name}: ${toolGroup.description}`);
10151019
response.push('Available tools:');
10161020
const toolDefinitionsMessage = toolGroup.tools

src/TextSnapshot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ export class TextSnapshot {
149149
}
150150

151151
// ExtraHandles represent DOM nodes which might not be part of the accessibility tree, e.g. DOM nodes
152-
// returned by in-page tools. We insert them into the tree by finding the closest ancestor in the
153-
// tree and inserting the node as a child. The ancestor's child nodes are re-parented if necessary.
152+
// returned by third-party developer tools. We insert them into the tree by finding the closest ancestor
153+
// in the tree and inserting the node as a child. The ancestor's child nodes are re-parented if necessary.
154154
private static async insertExtraNodes(
155155
page: McpPage,
156156
idToNode: Map<string, TextSnapshotNode>,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ export const cliOptions = {
237237
describe:
238238
'Set to true to include tools related to extensions. Note: This feature is currently only supported with a pipe connection. autoConnect, browserUrl, and wsEndpoint are not supported with this feature until 149 will be released.',
239239
},
240-
categoryInPageTools: {
240+
categoryThirdPartyDeveloperTools: {
241241
type: 'boolean',
242242
hidden: true,
243243
describe:
244-
'Set to true to enable tools exposed by the inspected page itself',
244+
'Set to true to enable third-party developer tools exposed by the inspected page itself',
245245
},
246246
performanceCrux: {
247247
type: 'boolean',

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ export async function createMcpServer(
168168
return;
169169
}
170170
if (
171-
tool.annotations.category === ToolCategory.IN_PAGE &&
172-
!serverArgs.categoryInPageTools
171+
tool.annotations.category === ToolCategory['3P_DEVELOPER'] &&
172+
!serverArgs.categoryThirdPartyDeveloperTools
173173
) {
174174
return;
175175
}

src/telemetry/flag_usage_metrics.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@
191191
"flagType": "boolean"
192192
},
193193
{
194-
"name": "category_in_page_tools",
194+
"name": "category_third_party_developer_tools",
195195
"flagType": "boolean"
196196
},
197197
{
198-
"name": "category_in_page_tools_present",
198+
"name": "category_third_party_developer_tools_present",
199199
"flagType": "boolean"
200200
},
201201
{

src/telemetry/tool_call_metrics.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
]
116116
},
117117
{
118-
"name": "execute_in_page_tool",
118+
"name": "execute_3p_developer_tool",
119119
"args": [
120120
{
121121
"name": "tool_name_length",
@@ -253,7 +253,7 @@
253253
"args": []
254254
},
255255
{
256-
"name": "list_in_page_tools",
256+
"name": "list_3p_developer_tools",
257257
"args": []
258258
},
259259
{

src/tools/ToolDefinition.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import type {PaginationOptions} from '../utils/types.js';
2828
import type {ToolCategory} from './categories.js';
2929
import type {
3030
ToolGroup,
31-
ToolDefinition as InPageToolDefinition,
32-
} from './inPage.js';
31+
ToolDefinition as ThirdPartyDeveloperToolDefinition,
32+
} from './thirdPartyDeveloper.js';
3333

3434
export interface BaseToolDefinition<
3535
Schema extends zod.ZodRawShape = zod.ZodRawShape,
@@ -151,7 +151,7 @@ export interface Response {
151151
): void;
152152
setListExtensions(): void;
153153
attachLighthouseResult(result: LighthouseData): void;
154-
setListInPageTools(): void;
154+
setListThirdPartyDeveloperTools(): void;
155155
setListWebMcpTools(): void;
156156
}
157157

@@ -261,8 +261,10 @@ export type ContextPage = Readonly<{
261261
action: () => Promise<unknown>,
262262
options?: {timeout?: number; handleDialog?: 'accept' | 'dismiss' | string},
263263
): Promise<void>;
264-
getInPageTools(): ToolGroup<InPageToolDefinition> | undefined;
265-
executeInPageTool(
264+
getThirdPartyDeveloperTools():
265+
| ToolGroup<ThirdPartyDeveloperToolDefinition>
266+
| undefined;
267+
executeThirdPartyDeveloperTool(
266268
toolName: string,
267269
params: Record<string, unknown>,
268270
response: Response,

src/tools/categories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export enum ToolCategory {
1212
NETWORK = 'network',
1313
DEBUGGING = 'debugging',
1414
EXTENSIONS = 'extensions',
15-
IN_PAGE = 'in-page',
15+
'3P_DEVELOPER' = '3p-developer',
1616
MEMORY = 'memory',
1717
}
1818

@@ -24,7 +24,7 @@ export const labels = {
2424
[ToolCategory.NETWORK]: 'Network',
2525
[ToolCategory.DEBUGGING]: 'Debugging',
2626
[ToolCategory.EXTENSIONS]: 'Extensions',
27-
[ToolCategory.IN_PAGE]: 'In-page tools',
27+
[ToolCategory['3P_DEVELOPER']]: 'Third-party developer tools',
2828
[ToolCategory.MEMORY]: 'Memory',
2929
};
3030

src/tools/pages.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const listPages = defineTool(args => {
8787
blockedByDialog: false,
8888
handler: async (_request, response) => {
8989
response.setIncludePages(true);
90-
response.setListInPageTools();
90+
response.setListThirdPartyDeveloperTools();
9191
response.setListWebMcpTools();
9292
},
9393
};
@@ -116,7 +116,7 @@ export const selectPage = defineTool({
116116
const page = context.getPageById(request.params.pageId);
117117
context.selectPage(page);
118118
response.setIncludePages(true);
119-
response.setListInPageTools();
119+
response.setListThirdPartyDeveloperTools();
120120
response.setListWebMcpTools();
121121
if (request.params.bringToFront) {
122122
await page.pptrPage.bringToFront();
@@ -148,7 +148,7 @@ export const closePage = defineTool({
148148
}
149149
}
150150
response.setIncludePages(true);
151-
response.setListInPageTools();
151+
response.setListThirdPartyDeveloperTools();
152152
},
153153
});
154154

@@ -206,7 +206,7 @@ export const newPage = defineTool(args => {
206206
);
207207

208208
response.setIncludePages(true);
209-
response.setListInPageTools();
209+
response.setListThirdPartyDeveloperTools();
210210
},
211211
};
212212
});
@@ -373,7 +373,7 @@ export const navigatePage = definePageTool(args => {
373373
}
374374

375375
response.setIncludePages(true);
376-
response.setListInPageTools();
376+
response.setListThirdPartyDeveloperTools();
377377
response.setListWebMcpTools();
378378
},
379379
};

0 commit comments

Comments
 (0)