豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit bdbbc84

Browse files
madhaviaidependabot[bot]OrKoNLightning00Blade
authored
fix: improve tool descriptions (#965)
Addresses cases where DevTools MCP tools were not consistently picked up from natural language prompts by improving tool descriptions and metadata. Validation: Tested locally across multiple prompts related to LCP and page performance. MCP tools were selected more consistently after the description updates. Refs #940 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com> Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
1 parent a02a567 commit bdbbc84

File tree

5 files changed

+105
-9
lines changed

5 files changed

+105
-9
lines changed

docs/tool-reference.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run docs' to update-->
22

3-
# Chrome DevTools MCP Tool Reference (~6915 cl100k_base tokens)
3+
# Chrome DevTools MCP Tool Reference (~6927 cl100k_base tokens)
44

55
- **[Input automation](#input-automation)** (9 tools)
66
- [`click`](#click)
@@ -165,7 +165,7 @@
165165

166166
### `navigate_page`
167167

168-
**Description:** Navigates the currently selected page to a URL.
168+
**Description:** Go to a URL, or back, forward, or reload. Use project URL if not specified otherwise.
169169

170170
**Parameters:**
171171

@@ -180,7 +180,7 @@
180180

181181
### `new_page`
182182

183-
**Description:** Creates a new page
183+
**Description:** Open a new tab and load a URL. Use project URL if not specified otherwise.
184184

185185
**Parameters:**
186186

@@ -256,7 +256,7 @@
256256

257257
### `performance_start_trace`
258258

259-
**Description:** Starts a performance trace recording on the selected page. This can be used to look for performance problems and insights to improve the performance of the page. It will also report Core Web Vital (CWV) scores for the page.
259+
**Description:** Start a performance trace on the selected webpage. Use to find frontend performance issues, Core Web Vitals (LCP, INP, CLS), and improve page load speed.
260260

261261
**Parameters:**
262262

@@ -268,7 +268,7 @@
268268

269269
### `performance_stop_trace`
270270

271-
**Description:** Stops the active performance trace recording on the selected page.
271+
**Description:** Stop the active performance trace recording on the selected webpage.
272272

273273
**Parameters:**
274274

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* @license
3+
* Copyright 2026 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Eval scenario: user asks to fix issues with their webpage (no URL given).
7+
* When no URL is provided, the model should pick the current frontend and run
8+
* and inspect it. Verifies the MCP server is invoked and the model opens the
9+
* frontend and inspects it (snapshot, console, or network).
10+
*
11+
* Note: Tools like performance_start_trace, take_snapshot, list_console_messages,
12+
* and list_network_requests do not require a URL in the prompt—they operate on
13+
* the currently selected page. Only navigate_page/new_page need a URL to open
14+
* a page; the eval runner injects the test URL when htmlRoute is set.
15+
*/
16+
17+
import assert from 'node:assert';
18+
19+
import type {TestScenario} from '../eval_gemini.ts';
20+
21+
const INSPECTION_TOOLS = [
22+
'take_snapshot',
23+
'list_console_messages',
24+
'list_network_requests',
25+
];
26+
27+
export const scenario: TestScenario = {
28+
prompt: 'Can you fix issues with my webpage?',
29+
maxTurns: 4,
30+
htmlRoute: {
31+
path: '/fix_issues_test.html',
32+
htmlContent: `
33+
<h1>Test Page</h1>
34+
<p>Some content</p>
35+
<script>
36+
console.error('Intentional error for testing');
37+
</script>
38+
`,
39+
},
40+
expectations: calls => {
41+
const NAVIGATION_TOOLS = ['navigate_page', 'new_page'];
42+
assert.ok(
43+
calls.length >= 2,
44+
'Expected at least navigation and one inspection',
45+
);
46+
const navigationIndex = calls.findIndex(c =>
47+
NAVIGATION_TOOLS.includes(c.name),
48+
);
49+
assert.ok(
50+
navigationIndex !== -1,
51+
`Expected a navigation call (${NAVIGATION_TOOLS.join(' or ')}), got: ${calls.map(c => c.name).join(', ')}`,
52+
);
53+
const afterNavigation = calls.slice(navigationIndex + 1);
54+
const inspectionCalls = afterNavigation.filter(c =>
55+
INSPECTION_TOOLS.includes(c.name),
56+
);
57+
assert.ok(
58+
inspectionCalls.length >= 1,
59+
`Expected at least one inspection tool (${INSPECTION_TOOLS.join(', ')}) after navigation, got: ${calls.map(c => c.name).join(', ')}`,
60+
);
61+
},
62+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* @license
3+
* Copyright 2026 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Eval scenario using "website"/"webpage" wording to verify the model invokes
7+
* the right tools when users ask to open a site and read its content.
8+
*/
9+
10+
import assert from 'node:assert';
11+
12+
import type {TestScenario} from '../eval_gemini.ts';
13+
14+
export const scenario: TestScenario = {
15+
prompt:
16+
'Open the website at <TEST_URL> and tell me what content is on the page.',
17+
maxTurns: 3,
18+
htmlRoute: {
19+
path: '/frontend_snapshot.html',
20+
htmlContent: '<h1>Frontend Test</h1><p>This is a test webpage.</p>',
21+
},
22+
expectations: calls => {
23+
assert.strictEqual(calls.length, 2);
24+
assert.ok(
25+
calls[0].name === 'navigate_page' || calls[0].name === 'new_page',
26+
'First call should be navigation',
27+
);
28+
assert.strictEqual(
29+
calls[1].name,
30+
'take_snapshot',
31+
'Second call should be take_snapshot to read page content',
32+
);
33+
},
34+
};

src/tools/pages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const closePage = defineTool({
8787

8888
export const newPage = defineTool({
8989
name: 'new_page',
90-
description: `Creates a new page`,
90+
description: `Open a new tab and load a URL. Use project URL if not specified otherwise.`,
9191
annotations: {
9292
category: ToolCategory.NAVIGATION,
9393
readOnlyHint: false,
@@ -131,7 +131,7 @@ export const newPage = defineTool({
131131

132132
export const navigatePage = definePageTool({
133133
name: 'navigate_page',
134-
description: `Navigates the currently selected page to a URL.`,
134+
description: `Go to a URL, or back, forward, or reload. Use project URL if not specified otherwise.`,
135135
annotations: {
136136
category: ToolCategory.NAVIGATION,
137137
readOnlyHint: false,

src/tools/performance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const filePathSchema = zod
2828

2929
export const startTrace = definePageTool({
3030
name: 'performance_start_trace',
31-
description: `Starts a performance trace recording on the selected page. This can be used to look for performance problems and insights to improve the performance of the page. It will also report Core Web Vital (CWV) scores for the page.`,
31+
description: `Start a performance trace on the selected webpage. Use to find frontend performance issues, Core Web Vitals (LCP, INP, CLS), and improve page load speed.`,
3232
annotations: {
3333
category: ToolCategory.PERFORMANCE,
3434
readOnlyHint: false,
@@ -117,7 +117,7 @@ export const startTrace = definePageTool({
117117
export const stopTrace = definePageTool({
118118
name: 'performance_stop_trace',
119119
description:
120-
'Stops the active performance trace recording on the selected page.',
120+
'Stop the active performance trace recording on the selected webpage.',
121121
annotations: {
122122
category: ToolCategory.PERFORMANCE,
123123
readOnlyHint: false,

0 commit comments

Comments
 (0)