Skip to content

Commit a651e46

Browse files
authored
Merge branch 'main' into fix/reject-json-array-tool-params
2 parents 035c6d3 + c0349ce commit a651e46

35 files changed

Lines changed: 1363 additions & 933 deletions

‎.github/workflows/pre-release.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
NODE_ENV: 'production'
5353

5454
- name: Verify server.json
55+
if: runner.os == 'Linux'
5556
shell: bash
5657
run: npm run verify-server-json-version
5758

‎.gitmodules‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
url = https://github.com/ChromeDevTools/devtools-frontend.git
44
branch = main
55
shallow = true
6+
fetchRecurseSubmodules = false

‎docs/configuration.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ The Chrome DevTools MCP server supports the following configuration option:
168168
- **Type:** number
169169

170170
- **`--blockedUrlPattern`/ `--blocked-url-pattern`**
171-
Restricts browser's network access by blocking specified URL patterns (uses https://urlpattern.spec.whatwg.org/). Silently detaches from targets with blocked URLs upon connection, and blocks runtime requests (including navigations and subresources). Accepts an array of patterns.
171+
Restricts browser's network access by blocking specified URL patterns (uses https://urlpattern.spec.whatwg.org/). Silently detaches from targets with blocked URLs upon connection, and blocks runtime requests (including navigations and subresources). Accepts an array of patterns. A pattern that uses a regexp group in any component (for example `(127\.\d+\.\d+\.\d+)` in the hostname) is rejected, because it is not enforced on redirects or subresources; use an exact value or a `*`/`:name` wildcard instead.
172172
- **Type:** array
173173

174174
- **`--allowedUrlPattern`/ `--allowed-url-pattern`**
175-
Restricts browser's network access by allowing only specified URL patterns (uses https://urlpattern.spec.whatwg.org/). Requires Chrome 149+. Silently detaches from targets with unallowed URLs upon connection, and blocks runtime requests (including navigations and subresources). Accepts an array of patterns.
175+
Restricts browser's network access by allowing only specified URL patterns (uses https://urlpattern.spec.whatwg.org/). Requires Chrome 149+. Silently detaches from targets with unallowed URLs upon connection, and blocks runtime requests (including navigations and subresources). Accepts an array of patterns. A pattern that uses a regexp group in any component (for example `(127\.\d+\.\d+\.\d+)` in the hostname) is rejected, because it is not enforced on redirects or subresources; use an exact value or a `*`/`:name` wildcard instead.
176176
- **Type:** array
177177

178178
- **`--performanceCrux`/ `--performance-crux`**

‎docs/tool-reference.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,10 @@
404404

405405
### `get_css_styles`
406406

407-
**Description:** Retrieve matched CSS rules, inline styles, inherited styles, and cascade information for an element identified by its UID.
408-
Use this tool to debug why specific CSS properties are applied, overridden, or conflicting. Results are paginated and return 10 rules per page by default; use pageIdx to page through the remaining rules. Requires a UID from [`take_snapshot`](#take_snapshot).
407+
**Description:** Retrieve matched CSS rules, inline styles (element.style), inherited styles, custom properties, and cascade wrappers (@layer, @media, @container, @scope) for an element identified by its UID.
408+
Rules are ordered from highest to lowest cascade precedence and include source line numbers (e.g. index:196). Active (winning) declarations have no prefix tag, while (losing) overridden declarations are prefixed with [overloaded].
409+
Treat the output as authoritative and complete.
410+
Results are paginated (10 rules per page by default); use pageIdx to page through the remaining rules. Requires a UID from [`take_snapshot`](#take_snapshot).
409411

410412
**Parameters:**
411413

‎package-lock.json‎

Lines changed: 258 additions & 607 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"scripts": {
1212
"cli:generate": "node scripts/generate-cli.ts",
1313
"clean": "node -e \"require('fs').rmSync('build', {recursive: true, force: true})\"",
14+
"clean:submodules": "node scripts/clean-submodules.ts",
1415
"bundle": "npm run clean && npm run build && rollup -c rollup.config.js && node -e \"require('fs').rmSync('build/node_modules', {recursive: true, force: true})\" && node scripts/append-lighthouse-notices.ts",
1516
"build": "tsc && node scripts/post-build.ts",
1617
"typecheck": "tsc --noEmit",
@@ -76,10 +77,10 @@
7677
"eslint-import-resolver-typescript": "^4.4.4",
7778
"eslint-plugin-import": "^2.32.0",
7879
"globals": "^17.0.0",
79-
"lighthouse": "13.4.1",
80+
"lighthouse": "13.5.0",
8081
"prettier": "^3.6.2",
81-
"puppeteer": "25.11.0",
82-
"rollup": "4.63.3",
82+
"puppeteer": "25.12.0",
83+
"rollup": "4.63.4",
8384
"rollup-plugin-cleanup": "^3.2.1",
8485
"rollup-plugin-license": "^3.6.0",
8586
"semver": "^7.7.4",

‎scripts/clean-submodules.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* @license
3+
* Copyright 2026 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import {rmSync, existsSync} from 'node:fs';
8+
import {resolve} from 'node:path';
9+
10+
const projectRoot = process.cwd();
11+
12+
console.log('Cleaning submodules...');
13+
14+
const directoriesToRemove = [
15+
resolve(projectRoot, 'third_party', 'devtools-frontend'),
16+
resolve(projectRoot, '.git', 'modules', 'devtools-frontend'),
17+
];
18+
19+
for (const dir of directoriesToRemove) {
20+
try {
21+
if (existsSync(dir)) {
22+
rmSync(dir, {recursive: true, force: true});
23+
console.log(`Removed ${dir}`);
24+
}
25+
} catch (error) {
26+
console.error(`Failed to remove ${dir}:`, error);
27+
}
28+
}
29+
30+
console.log(
31+
'Submodules cleaned. You can now run `npm run prepare` to re-initialize them.',
32+
);

‎scripts/prepare.ts‎

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import {execSync} from 'node:child_process';
8-
import {existsSync, readFileSync, writeFileSync} from 'node:fs';
8+
import {existsSync, readFileSync, writeFileSync, rmSync} from 'node:fs';
99
import {resolve} from 'node:path';
1010

1111
const projectRoot = process.cwd();
@@ -51,29 +51,60 @@ function ensureSubmodule(): void {
5151
return;
5252
}
5353

54-
console.log('Initializing devtools-frontend submodule...');
54+
console.log(
55+
'Initializing devtools-frontend submodule with sparse checkout...',
56+
);
5557
try {
56-
execSync('git submodule update --init --depth 1', {
58+
const gitModuleDir = resolve(
59+
projectRoot,
60+
'.git',
61+
'modules',
62+
'devtools-frontend',
63+
);
64+
// If the submodule was previously initialized (e.g. as a full checkout),
65+
// the existing directories will cause `git clone` or `absorbgitdirs` to fail.
66+
// We clean them up here to ensure the sparse checkout initialization succeeds.
67+
if (existsSync(devtoolsFrontendDir)) {
68+
rmSync(devtoolsFrontendDir, {recursive: true, force: true});
69+
}
70+
if (existsSync(gitModuleDir)) {
71+
rmSync(gitModuleDir, {recursive: true, force: true});
72+
}
73+
74+
// 1. Clone only the tree structure of the default branch (no blobs)
75+
execSync(
76+
'git clone --no-checkout --depth 1 --filter=blob:none https://github.com/ChromeDevTools/devtools-frontend.git third_party/devtools-frontend',
77+
{
78+
cwd: projectRoot,
79+
stdio: 'inherit',
80+
},
81+
);
82+
83+
// 2. Set the sparse checkout configuration
84+
execSync(
85+
'git sparse-checkout set --no-cone "/*" "!/*/" "/front_end/" "!/front_end/panels/" "!/front_end/ui/" "/mcp/" "/extension-api/"',
86+
{
87+
cwd: devtoolsFrontendDir,
88+
stdio: 'inherit',
89+
},
90+
);
91+
92+
// 3. Move the submodule's .git directory to the superproject's .git/modules
93+
execSync('git submodule absorbgitdirs third_party/devtools-frontend', {
5794
cwd: projectRoot,
5895
stdio: 'inherit',
5996
});
60-
} catch (submoduleError) {
61-
console.warn('git submodule update failed:', submoduleError);
62-
}
6397

64-
if (!existsSync(mcpEntry)) {
65-
console.log('Fetching devtools-frontend...');
66-
try {
67-
execSync(
68-
'git clone --depth 1 https://github.com/ChromeDevTools/devtools-frontend.git third_party/devtools-frontend',
69-
{
70-
cwd: projectRoot,
71-
stdio: 'inherit',
72-
},
73-
);
74-
} catch (cloneError) {
75-
console.error('Failed to clone devtools-frontend:', cloneError);
76-
}
98+
// 4. Update the submodule to the correct commit (this fetches the commit and only downloads the blobs for the sparse checkout)
99+
execSync(
100+
'git submodule update --force --checkout third_party/devtools-frontend',
101+
{
102+
cwd: projectRoot,
103+
stdio: 'inherit',
104+
},
105+
);
106+
} catch (error) {
107+
console.error('Failed to initialize devtools-frontend:', error);
77108
}
78109
}
79110

‎skills/chrome-devtools-cli/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ chrome-devtools list_network_requests 1 --includePreservedRequests true # Includ
135135
chrome-devtools evaluate_script "() => document.title" --pageId 1 # Evaluate a JavaScript function on page 1
136136
chrome-devtools evaluate_script "(a) => a.innerText" --pageId 1 --args 1_4 # Evaluate JS with UID arguments on page 1
137137
chrome-devtools get_console_message 1 1 # Gets a console message by its ID
138-
chrome-devtools get_css_styles 1 "1_4" # Retrieves resolved CSS styles (inline, matched, inherited, pseudo) for an element on page 1
139-
chrome-devtools get_css_styles 1 "1_4" --pageSize 20 --pageIdx 0 # Get CSS styles with pagination on page 1
138+
chrome-devtools get_css_styles 1 "1_4" # Get CSS styles with pagination on page 1 (default: 10 rules, pageIdx 0)
139+
chrome-devtools get_css_styles 1 "1_4" --pageSize 20 --pageIdx 1 # Paginate CSS rules with custom page size and custom 0-based page index
140140
chrome-devtools lighthouse_audit 1 --mode "navigation" # Run Lighthouse audit for navigation
141141
chrome-devtools lighthouse_audit 1 --mode "snapshot" --device "mobile" # Run Lighthouse audit for a snapshot on mobile
142142
chrome-devtools lighthouse_audit 1 --outputDirPath ./out # Run Lighthouse audit and save reports

‎skills/chrome-devtools/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Note: For `evaluate_script`, `pageId` is required when targeting pages. However,
3434

3535
- **Automation/interaction**: `take_snapshot` (text-based, faster, better for automation)
3636
- **Visual inspection**: `take_screenshot` (when user needs to see visual state)
37-
- **CSS & Styling inspection**: Use `get_css_styles` to inspect matched rules, cascade, and CSS variables.
38-
- **Additional details**: Use `evaluate_script` for final resolved values (`getComputedStyle`) or runtime DOM/JS data not in the accessibility tree.
37+
- **CSS & Styling inspection**: Use `get_css_styles` to inspect matched rules, cascade, and CSS variables. Treat the output as authoritative and complete.
38+
- **Additional details**: Use `evaluate_script` for runtime DOM/JS data not available via `get_css_styles` or `take_snapshot`.
3939

4040
### Parallel execution
4141

0 commit comments

Comments
 (0)