chrome-devtools-mcp 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -14
- package/build/src/McpContext.js +60 -24
- package/build/src/McpPage.js +5 -3
- package/build/src/McpResponse.js +22 -4
- package/build/src/ToolHandler.js +66 -12
- package/build/src/bin/chrome-devtools-mcp-main.js +2 -2
- package/build/src/bin/chrome-devtools.js +29 -30
- package/build/src/browser.js +3 -1
- package/build/src/{PageCollector.js → collectors/PageCollector.js} +7 -7
- package/build/src/{ServiceWorkerCollector.js → collectors/ServiceWorkerCollector.js} +1 -1
- package/build/src/{bin/chrome-devtools-cli-options.js → config/cli-options.js} +378 -23
- package/build/src/{bin/chrome-devtools-mcp-cli-options.js → config/mcp-options.js} +73 -8
- package/build/src/daemon/client.js +11 -2
- package/build/src/daemon/daemon.js +2 -2
- package/build/src/devtools/DevtoolsUtils.js +2 -14
- package/build/src/formatters/ConsoleFormatter.js +43 -10
- package/build/src/formatters/HeapSnapshotFormatter.js +10 -2
- package/build/src/formatters/IssueFormatter.js +1 -1
- package/build/src/formatters/NetworkFormatter.js +7 -7
- package/build/src/index.js +33 -5
- package/build/src/{HeapSnapshotManager.js → processors/HeapSnapshotManager.js} +21 -5
- package/build/src/{trace-processing/parse.js → processors/PerformanceTrace.js} +1 -1
- package/build/src/telemetry/ClearcutLogger.js +13 -1
- package/build/src/telemetry/flagUtils.js +4 -3
- package/build/src/telemetry/types.js +4 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +6 -63
- package/build/src/third_party/bundled-packages.json +4 -4
- package/build/src/third_party/devtools-heap-snapshot-worker.js +274 -42
- package/build/src/third_party/index.js +35378 -35538
- package/build/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
- package/build/src/tools/categories.js +3 -0
- package/build/src/tools/console.js +9 -3
- package/build/src/tools/emulation.js +2 -2
- package/build/src/tools/extensions.js +7 -5
- package/build/src/tools/input.js +26 -16
- package/build/src/tools/lighthouse.js +3 -1
- package/build/src/tools/memory.js +112 -16
- package/build/src/tools/network.js +6 -3
- package/build/src/tools/pages.js +12 -16
- package/build/src/tools/performance.js +15 -25
- package/build/src/tools/pwa.js +128 -0
- package/build/src/tools/screencast.js +6 -4
- package/build/src/tools/screenshot.js +42 -9
- package/build/src/tools/script.js +28 -8
- package/build/src/tools/slim/tools.js +3 -3
- package/build/src/tools/snapshot.js +5 -3
- package/build/src/tools/thirdPartyDeveloper.js +2 -2
- package/build/src/tools/tools.js +2 -0
- package/build/src/tools/webmcp.js +2 -2
- package/build/src/{WaitForHelper.js → utils/WaitForHelper.js} +63 -38
- package/build/src/utils/bytes.js +105 -0
- package/build/src/utils/logger.js +25 -11
- package/build/src/version.js +1 -1
- package/package.json +20 -12
- package/skills/a11y-debugging/SKILL.md +2 -0
- package/skills/chrome-devtools/SKILL.md +5 -4
- package/skills/chrome-devtools-cli/SKILL.md +109 -64
- package/skills/debug-optimize-lcp/SKILL.md +9 -9
- package/skills/memory-leak-debugging/SKILL.md +2 -2
- package/skills/troubleshooting/SKILL.md +1 -0
- package/build/src/utils/string.js +0 -37
|
@@ -11,9 +11,9 @@ _Note: If this is your very first time using the CLI, see [references/installati
|
|
|
11
11
|
|
|
12
12
|
## AI Workflow
|
|
13
13
|
|
|
14
|
-
1. **Execute**: Run tools directly
|
|
15
|
-
2. **Inspect**: Use `take_snapshot
|
|
16
|
-
3. **Act**: Use `click
|
|
14
|
+
1. **Execute**: Run tools directly. If you don't know the target page's ID, run `chrome-devtools list_pages` to find it. The background server starts implicitly; **do not** run `start`/`status`/`stop` before each use.
|
|
15
|
+
2. **Inspect**: Use `chrome-devtools take_snapshot <pageId>` to get an element `<uid>`.
|
|
16
|
+
3. **Act**: Use `chrome-devtools click <pageId> <uid>`, `chrome-devtools fill <pageId> <uid> <value>`, etc. State persists across commands.
|
|
17
17
|
|
|
18
18
|
Snapshot example:
|
|
19
19
|
|
|
@@ -22,35 +22,45 @@ uid=1_0 RootWebArea "Example Domain" url="https://example.com/"
|
|
|
22
22
|
uid=1_1 heading "Example Domain" level="1"
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
## Permissions & File Access
|
|
26
|
+
|
|
27
|
+
By default, the server only has access to the **OS temp directory** (as defined by Node APIs, `os.tmpdir()`). File-saving parameters (`--filePath`, `--outputDirPath`) and `upload_file` outside the temp directory require unrestricted filesystem access:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Start daemon with full filesystem access
|
|
31
|
+
chrome-devtools start --allowUnrestrictedPaths=true
|
|
32
|
+
```
|
|
33
|
+
|
|
25
34
|
## Command Usage
|
|
26
35
|
|
|
27
36
|
```sh
|
|
28
37
|
chrome-devtools <tool> [arguments] [flags]
|
|
29
38
|
```
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
- Required arguments are passed positionally; optional arguments use flags.
|
|
41
|
+
- Use `--help` on any command for usage details.
|
|
42
|
+
- Output defaults to plain Markdown-like text; pass `--output-format=json` for JSON.
|
|
32
43
|
|
|
33
44
|
## Input Automation (<uid> from snapshot)
|
|
34
45
|
|
|
35
46
|
```bash
|
|
36
|
-
chrome-devtools take_snapshot
|
|
37
|
-
chrome-devtools
|
|
38
|
-
chrome-devtools click "id" #
|
|
39
|
-
chrome-devtools
|
|
40
|
-
chrome-devtools drag "src" "dst" # Drag an element
|
|
41
|
-
chrome-devtools
|
|
42
|
-
chrome-devtools fill "id" "text"
|
|
43
|
-
chrome-devtools
|
|
44
|
-
chrome-devtools handle_dialog
|
|
45
|
-
chrome-devtools
|
|
46
|
-
chrome-devtools hover "id" # Hover over
|
|
47
|
-
chrome-devtools
|
|
48
|
-
chrome-devtools press_key "
|
|
49
|
-
chrome-devtools
|
|
50
|
-
chrome-devtools type_text "hello" # Type text
|
|
51
|
-
chrome-devtools
|
|
52
|
-
chrome-devtools upload_file "id" "file.txt" # Upload a file
|
|
53
|
-
chrome-devtools upload_file "id" "file.txt" --includeSnapshot true # Upload a file and return a snapshot
|
|
47
|
+
chrome-devtools take_snapshot 1 # Take a text snapshot of the page to get UIDs for elements
|
|
48
|
+
chrome-devtools click 1 "id" # Clicks on the provided element
|
|
49
|
+
chrome-devtools click 1 "id" --dblClick true --includeSnapshot true # Double clicks and returns a snapshot
|
|
50
|
+
chrome-devtools drag 1 "src" "dst" # Drag an element onto another element
|
|
51
|
+
chrome-devtools drag 1 "src" "dst" --includeSnapshot true # Drag an element and return a snapshot
|
|
52
|
+
chrome-devtools fill 1 "id" "text" # Type text into an input, textarea, or select an option
|
|
53
|
+
chrome-devtools fill 1 "id" "text" --includeSnapshot true # Fill an element and return a snapshot
|
|
54
|
+
chrome-devtools handle_dialog 1 accept # Handle a browser dialog (accept/dismiss)
|
|
55
|
+
chrome-devtools handle_dialog 1 dismiss --promptText "hi" # Dismiss a dialog with prompt text
|
|
56
|
+
chrome-devtools hover 1 "id" # Hover over the provided element
|
|
57
|
+
chrome-devtools hover 1 "id" --includeSnapshot true # Hover over an element and return a snapshot
|
|
58
|
+
chrome-devtools press_key 1 "Enter" # Press a key or key combination ("Control+A", "Escape")
|
|
59
|
+
chrome-devtools press_key 1 "Control+A" --includeSnapshot true # Press a key and return a snapshot
|
|
60
|
+
chrome-devtools type_text 1 "hello" # Type text using keyboard into a focused input
|
|
61
|
+
chrome-devtools type_text 1 "hello" --submitKey "Enter" # Type text and press a submit key
|
|
62
|
+
chrome-devtools upload_file 1 "id" "file.txt" # Upload a file through a provided element
|
|
63
|
+
chrome-devtools upload_file 1 "id" "file.txt" --includeSnapshot true # Upload a file and return a snapshot
|
|
54
64
|
```
|
|
55
65
|
|
|
56
66
|
## Navigation
|
|
@@ -58,11 +68,11 @@ chrome-devtools upload_file "id" "file.txt" --includeSnapshot true # Upload a fi
|
|
|
58
68
|
```bash
|
|
59
69
|
chrome-devtools close_page 1 # Closes the page by its index
|
|
60
70
|
chrome-devtools list_pages # Get a list of pages open in the browser
|
|
61
|
-
chrome-devtools navigate_page --url "https://example.com" # Navigates the currently selected page to a URL
|
|
62
|
-
chrome-devtools navigate_page --type "reload" --ignoreCache true # Reload page ignoring cache
|
|
63
|
-
chrome-devtools navigate_page --url "https://example.com" --timeout 5000 # Navigate with a timeout
|
|
64
|
-
chrome-devtools navigate_page --handleBeforeUnload "accept" # Handle before unload dialog
|
|
65
|
-
chrome-devtools navigate_page --type "back" --initScript "foo()" # Navigate back and run an init script
|
|
71
|
+
chrome-devtools navigate_page 1 --url "https://example.com" # Navigates the currently selected page to a URL
|
|
72
|
+
chrome-devtools navigate_page 1 --type "reload" --ignoreCache true # Reload page ignoring cache
|
|
73
|
+
chrome-devtools navigate_page 1 --url "https://example.com" --timeout 5000 # Navigate with a timeout
|
|
74
|
+
chrome-devtools navigate_page 1 --handleBeforeUnload "accept" # Handle before unload dialog
|
|
75
|
+
chrome-devtools navigate_page 1 --type "back" --initScript "foo()" # Navigate back and run an init script
|
|
66
76
|
chrome-devtools new_page "https://example.com" # Creates a new page
|
|
67
77
|
chrome-devtools new_page "https://example.com" --background true --timeout 5000 # Create new page in background
|
|
68
78
|
chrome-devtools new_page "https://example.com" --isolatedContext "ctx" # Create new page with isolated context
|
|
@@ -73,54 +83,75 @@ chrome-devtools select_page 1 --bringToFront true # Select a page and bring it t
|
|
|
73
83
|
## Emulation
|
|
74
84
|
|
|
75
85
|
```bash
|
|
76
|
-
chrome-devtools emulate --networkConditions "Offline" # Emulate network conditions
|
|
77
|
-
chrome-devtools emulate --cpuThrottlingRate 4 --geolocation "0x0" # Emulate CPU throttling and geolocation
|
|
78
|
-
chrome-devtools emulate --colorScheme "dark" --viewport "1920x1080" # Emulate color scheme and viewport
|
|
79
|
-
chrome-devtools emulate --userAgent "Mozilla/5.0..." # Emulate user agent
|
|
80
|
-
chrome-devtools resize_page 1920 1080 # Resizes the selected page's window
|
|
86
|
+
chrome-devtools emulate 1 --networkConditions "Offline" # Emulate network conditions
|
|
87
|
+
chrome-devtools emulate 1 --cpuThrottlingRate 4 --geolocation "0x0" # Emulate CPU throttling and geolocation
|
|
88
|
+
chrome-devtools emulate 1 --colorScheme "dark" --viewport "1920x1080" # Emulate color scheme and viewport
|
|
89
|
+
chrome-devtools emulate 1 --userAgent "Mozilla/5.0..." # Emulate user agent
|
|
90
|
+
chrome-devtools resize_page 1 1920 1080 # Resizes the selected page's window
|
|
81
91
|
```
|
|
82
92
|
|
|
83
93
|
## Performance
|
|
84
94
|
|
|
85
95
|
```bash
|
|
86
|
-
chrome-devtools performance_analyze_insight "1" "LCPBreakdown" # Get more details on a specific Performance Insight
|
|
87
|
-
chrome-devtools performance_start_trace true false # Starts a performance trace recording
|
|
88
|
-
chrome-devtools performance_start_trace true true --filePath t.gz # Start trace and save to a file
|
|
89
|
-
chrome-devtools performance_stop_trace # Stops the active performance trace
|
|
90
|
-
chrome-devtools performance_stop_trace --filePath "t.json" # Stop trace and save to a file
|
|
91
|
-
|
|
96
|
+
chrome-devtools performance_analyze_insight 1 "1" "LCPBreakdown" # Get more details on a specific Performance Insight (pageId, insightSetId, insightName)
|
|
97
|
+
chrome-devtools performance_start_trace 1 --reload true --autoStop false # Starts a performance trace recording (reload, autoStop)
|
|
98
|
+
chrome-devtools performance_start_trace 1 --reload true --autoStop true --filePath "t.json.gz" # Start trace and save to a file
|
|
99
|
+
chrome-devtools performance_stop_trace 1 # Stops the active performance trace
|
|
100
|
+
chrome-devtools performance_stop_trace 1 --filePath "t.json.gz" # Stop trace and save to a file
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Memory
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
chrome-devtools take_heapsnapshot 1 "./snap.heapsnapshot" # Capture a memory heap snapshot
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Memory Debugging (requires `--memoryDebugging=true`)
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
chrome-devtools get_heapsnapshot_summary "./snap.heapsnapshot" # Get snapshot summary stats
|
|
113
|
+
chrome-devtools compare_heapsnapshots "./base.heapsnapshot" "./target.heapsnapshot" # Compare two snapshots
|
|
114
|
+
chrome-devtools get_heapsnapshot_class_nodes "./snap.heapsnapshot" "Array" # Inspect class instances
|
|
115
|
+
chrome-devtools get_heapsnapshot_details "./snap.heapsnapshot" 123 # Detailed object properties
|
|
116
|
+
chrome-devtools get_heapsnapshot_dominators "./snap.heapsnapshot" 123 # Dominator tree for node
|
|
117
|
+
chrome-devtools get_heapsnapshot_duplicate_strings "./snap.heapsnapshot" # Find duplicated strings
|
|
118
|
+
chrome-devtools get_heapsnapshot_edges "./snap.heapsnapshot" 123 # Node edges/references
|
|
119
|
+
chrome-devtools get_heapsnapshot_object_details "./snap.heapsnapshot" 123 # Object details by node ID
|
|
120
|
+
chrome-devtools get_heapsnapshot_retainers "./snap.heapsnapshot" 123 # Retaining objects
|
|
121
|
+
chrome-devtools get_heapsnapshot_retaining_paths "./snap.heapsnapshot" 123 # Shortest retaining paths
|
|
122
|
+
chrome-devtools close_heapsnapshot "./snap.heapsnapshot" # Free memory from loaded snapshot
|
|
92
123
|
```
|
|
93
124
|
|
|
94
125
|
## Network
|
|
95
126
|
|
|
96
127
|
```bash
|
|
97
|
-
chrome-devtools get_network_request # Get the currently selected network request
|
|
98
|
-
chrome-devtools get_network_request --reqid 1 --requestFilePath req.md # Get request by id and save to file
|
|
99
|
-
chrome-devtools get_network_request --responseFilePath res.md # Save response body to file
|
|
100
|
-
chrome-devtools list_network_requests # List all network requests
|
|
101
|
-
chrome-devtools list_network_requests --pageSize 50 --pageIdx 0 # List network requests with pagination
|
|
102
|
-
chrome-devtools list_network_requests --resourceTypes Fetch # Filter requests by resource type
|
|
103
|
-
chrome-devtools list_network_requests --includePreservedRequests true # Include preserved requests
|
|
128
|
+
chrome-devtools get_network_request 1 # Get the currently selected network request for page 1
|
|
129
|
+
chrome-devtools get_network_request 1 --reqid 1 --requestFilePath "req.md" # Get request by id and save to file
|
|
130
|
+
chrome-devtools get_network_request 1 --responseFilePath "res.md" # Save response body to file
|
|
131
|
+
chrome-devtools list_network_requests 1 # List all network requests for page 1
|
|
132
|
+
chrome-devtools list_network_requests 1 --pageSize 50 --pageIdx 0 # List network requests with pagination
|
|
133
|
+
chrome-devtools list_network_requests 1 --resourceTypes Fetch # Filter requests by resource type
|
|
134
|
+
chrome-devtools list_network_requests 1 --includePreservedRequests true # Include preserved requests
|
|
104
135
|
```
|
|
105
136
|
|
|
106
137
|
## Debugging & Inspection
|
|
107
138
|
|
|
108
139
|
```bash
|
|
109
|
-
chrome-devtools evaluate_script "() => document.title" # Evaluate a JavaScript function on
|
|
110
|
-
chrome-devtools evaluate_script "(a) => a.innerText" --args 1_4 # Evaluate JS with UID arguments
|
|
111
|
-
chrome-devtools get_console_message 1 # Gets a console message by its ID
|
|
112
|
-
chrome-devtools lighthouse_audit --mode "navigation" # Run Lighthouse audit for navigation
|
|
113
|
-
chrome-devtools lighthouse_audit --mode "snapshot" --device "mobile" # Run Lighthouse audit for a snapshot on mobile
|
|
114
|
-
chrome-devtools lighthouse_audit --outputDirPath ./out # Run Lighthouse audit and save reports
|
|
115
|
-
chrome-devtools list_console_messages # List all console messages
|
|
116
|
-
chrome-devtools list_console_messages --pageSize 20 --pageIdx 1 # List console messages with pagination
|
|
117
|
-
chrome-devtools list_console_messages --types error --types info # Filter console messages by type
|
|
118
|
-
chrome-devtools list_console_messages --includePreservedMessages true # Include preserved messages
|
|
119
|
-
chrome-devtools take_screenshot # Take a screenshot of the page viewport
|
|
120
|
-
chrome-devtools take_screenshot --fullPage true --format "jpeg" --quality 80 # Take a full page screenshot as JPEG with quality
|
|
121
|
-
chrome-devtools take_screenshot --uid "id" --filePath "s.png" # Take a screenshot of an element
|
|
122
|
-
chrome-devtools take_snapshot # Take a text snapshot of the page from the a11y tree
|
|
123
|
-
chrome-devtools take_snapshot --verbose true --filePath "s.txt" # Take a verbose snapshot and save to file
|
|
140
|
+
chrome-devtools evaluate_script "() => document.title" --pageId 1 # Evaluate a JavaScript function on page 1
|
|
141
|
+
chrome-devtools evaluate_script "(a) => a.innerText" --pageId 1 --args 1_4 # Evaluate JS with UID arguments on page 1
|
|
142
|
+
chrome-devtools get_console_message 1 1 # Gets a console message by its ID
|
|
143
|
+
chrome-devtools lighthouse_audit 1 --mode "navigation" # Run Lighthouse audit for navigation
|
|
144
|
+
chrome-devtools lighthouse_audit 1 --mode "snapshot" --device "mobile" # Run Lighthouse audit for a snapshot on mobile
|
|
145
|
+
chrome-devtools lighthouse_audit 1 --outputDirPath ./out # Run Lighthouse audit and save reports
|
|
146
|
+
chrome-devtools list_console_messages 1 # List all console messages
|
|
147
|
+
chrome-devtools list_console_messages 1 --pageSize 20 --pageIdx 1 # List console messages with pagination
|
|
148
|
+
chrome-devtools list_console_messages 1 --types error --types info # Filter console messages by type
|
|
149
|
+
chrome-devtools list_console_messages 1 --includePreservedMessages true # Include preserved messages
|
|
150
|
+
chrome-devtools take_screenshot 1 # Take a screenshot of the page viewport
|
|
151
|
+
chrome-devtools take_screenshot 1 --fullPage true --format "jpeg" --quality 80 # Take a full page screenshot as JPEG with quality
|
|
152
|
+
chrome-devtools take_screenshot 1 --uid "id" --filePath "s.png" # Take a screenshot of an element
|
|
153
|
+
chrome-devtools take_snapshot 1 # Take a text snapshot of the page from the a11y tree
|
|
154
|
+
chrome-devtools take_snapshot 1 --verbose true --filePath "s.txt" # Take a verbose snapshot and save to file
|
|
124
155
|
```
|
|
125
156
|
|
|
126
157
|
## Extensions
|
|
@@ -133,21 +164,35 @@ chrome-devtools reload_extension "extension_id" # Reloads an unpacked Chrome ext
|
|
|
133
164
|
chrome-devtools trigger_extension_action "extension_id" # Triggers the default action of an extension by its ID
|
|
134
165
|
```
|
|
135
166
|
|
|
167
|
+
## Progressive Web Apps (requires `--categoryPwa=true`)
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
chrome-devtools install_pwa "https://example.com/" # Install PWA by manifest ID or URL
|
|
171
|
+
chrome-devtools launch_pwa "https://example.com/" # Launch installed PWA
|
|
172
|
+
chrome-devtools get_os_app_state "https://example.com/" # Get OS app installation state
|
|
173
|
+
chrome-devtools uninstall_pwa "https://example.com/" # Uninstall PWA and close windows
|
|
174
|
+
```
|
|
175
|
+
|
|
136
176
|
## Experimental Features
|
|
137
177
|
|
|
138
178
|
Experimental tools are disabled by default. Enable them with the corresponding flag during `start`.
|
|
139
179
|
|
|
140
180
|
```bash
|
|
141
|
-
chrome-devtools click_at 100 200 # Clicks at the provided coordinates (requires --experimentalVision=true)
|
|
142
|
-
chrome-devtools screencast_start # Starts a screencast recording (requires --experimentalScreencast=true and ffmpeg)
|
|
143
|
-
chrome-devtools screencast_stop # Stops the active screencast
|
|
144
|
-
chrome-devtools list_webmcp_tools # List all WebMCP tools (requires --categoryExperimentalWebmcp=true)
|
|
181
|
+
chrome-devtools click_at 1 100 200 # Clicks at the provided coordinates on page 1 (requires --experimentalVision=true)
|
|
182
|
+
chrome-devtools screencast_start 1 --filePath "screen.mp4" # Starts a screencast recording on page 1 (requires --experimentalScreencast=true and ffmpeg)
|
|
183
|
+
chrome-devtools screencast_stop 1 # Stops the active screencast on page 1
|
|
184
|
+
chrome-devtools list_webmcp_tools 1 # List all WebMCP tools on page 1 (requires --categoryExperimentalWebmcp=true)
|
|
185
|
+
chrome-devtools execute_webmcp_tool 1 "tool_name" --input '{"arg":"val"}' # Execute a WebMCP tool on page 1 (requires --categoryExperimentalWebmcp=true)
|
|
186
|
+
chrome-devtools list_3p_developer_tools 1 # List third-party developer tools on page 1 (requires --categoryExperimentalThirdParty=true)
|
|
187
|
+
chrome-devtools execute_3p_developer_tool 1 "tool_name" --params '{"arg":"val"}' # Execute third-party developer tool on page 1 (requires --categoryExperimentalThirdParty=true)
|
|
145
188
|
```
|
|
146
189
|
|
|
147
190
|
## Service Management
|
|
148
191
|
|
|
149
192
|
```bash
|
|
150
193
|
chrome-devtools start # Start or restart chrome-devtools-mcp
|
|
194
|
+
chrome-devtools start --allowUnrestrictedPaths=true # Start with full filesystem access
|
|
195
|
+
chrome-devtools start --headless=false # Start with visible browser window
|
|
151
196
|
chrome-devtools status # Checks if chrome-devtools-mcp is running
|
|
152
197
|
chrome-devtools stop # Stop chrome-devtools-mcp if any
|
|
153
198
|
```
|
|
@@ -36,8 +36,8 @@ Follow these steps in order. Each step builds on the previous one.
|
|
|
36
36
|
|
|
37
37
|
Navigate to the page, then record a trace with reload to capture the full page load including LCP:
|
|
38
38
|
|
|
39
|
-
1. `navigate_page` to the target URL.
|
|
40
|
-
2. `performance_start_trace` with `reload: true` and `autoStop: true`.
|
|
39
|
+
1. `navigate_page` with `pageId` to the target URL.
|
|
40
|
+
2. `performance_start_trace` with `pageId`, `reload: true` and `autoStop: true`.
|
|
41
41
|
|
|
42
42
|
The trace results will include LCP timing and available insight sets. Note the insight set IDs from the output — you'll need them in the next step.
|
|
43
43
|
|
|
@@ -50,11 +50,11 @@ Use `performance_analyze_insight` to drill into LCP-specific insights. Look for
|
|
|
50
50
|
- **RenderBlocking** — Resources blocking the LCP element from rendering.
|
|
51
51
|
- **LCPDiscovery** — Whether the LCP resource was discoverable early.
|
|
52
52
|
|
|
53
|
-
Call `performance_analyze_insight` with the insight set ID and the insight name from the trace results.
|
|
53
|
+
Call `performance_analyze_insight` with `pageId`, the insight set ID, and the insight name from the trace results.
|
|
54
54
|
|
|
55
55
|
### Step 3: Identify the LCP Element
|
|
56
56
|
|
|
57
|
-
Use `evaluate_script` with the **"Identify LCP Element" snippet** found in [references/lcp-snippets.md](references/lcp-snippets.md) to reveal the LCP element's tag, resource URL, and raw timing data.
|
|
57
|
+
Use `evaluate_script` (with `pageId`) and the **"Identify LCP Element" snippet** found in [references/lcp-snippets.md](references/lcp-snippets.md) to reveal the LCP element's tag, resource URL, and raw timing data.
|
|
58
58
|
|
|
59
59
|
The `url` field tells you what resource to look for in the network waterfall. If `url` is empty, the LCP element is text-based (no resource to load).
|
|
60
60
|
|
|
@@ -62,8 +62,8 @@ The `url` field tells you what resource to look for in the network waterfall. If
|
|
|
62
62
|
|
|
63
63
|
Use `list_network_requests` to see when the LCP resource loaded relative to other resources:
|
|
64
64
|
|
|
65
|
-
- Call `list_network_requests` filtered by `resourceTypes: ["Image", "Font"]` (adjust based on Step 3).
|
|
66
|
-
- Then use `get_network_request` with the LCP resource's request ID for full details.
|
|
65
|
+
- Call `list_network_requests` with `pageId` filtered by `resourceTypes: ["Image", "Font"]` (adjust based on Step 3).
|
|
66
|
+
- Then use `get_network_request` with `pageId` and the LCP resource's request ID for full details.
|
|
67
67
|
|
|
68
68
|
**Key Checks:**
|
|
69
69
|
|
|
@@ -72,7 +72,7 @@ Use `list_network_requests` to see when the LCP resource loaded relative to othe
|
|
|
72
72
|
|
|
73
73
|
### Step 5: Inspect HTML for Common Issues
|
|
74
74
|
|
|
75
|
-
Use `evaluate_script` with the **"Audit Common Issues" snippet** found in [references/lcp-snippets.md](references/lcp-snippets.md) to check for lazy-loaded images in the viewport, missing fetchpriority, and render-blocking scripts.
|
|
75
|
+
Use `evaluate_script` (with `pageId`) and the **"Audit Common Issues" snippet** found in [references/lcp-snippets.md](references/lcp-snippets.md) to check for lazy-loaded images in the viewport, missing fetchpriority, and render-blocking scripts.
|
|
76
76
|
|
|
77
77
|
## Optimization Strategies
|
|
78
78
|
|
|
@@ -115,7 +115,7 @@ The HTML document itself takes too long to arrive.
|
|
|
115
115
|
|
|
116
116
|
## Verifying Fixes & Emulation
|
|
117
117
|
|
|
118
|
-
- **Verification**: Re-run the trace (`performance_start_trace` with `reload: true`) and compare the new subpart breakdown. The bottleneck should shrink.
|
|
118
|
+
- **Verification**: Re-run the trace (`performance_start_trace` with `pageId` and `reload: true`) and compare the new subpart breakdown. The bottleneck should shrink.
|
|
119
119
|
- **Emulation**: Lab measurements differ from real-world experience. Use `emulate` to test under constraints:
|
|
120
|
-
- `emulate` with `networkConditions: "Fast 3G"` and `cpuThrottlingRate: 4`.
|
|
120
|
+
- `emulate` with `pageId`, `networkConditions: "Fast 3G"` and `cpuThrottlingRate: 4`.
|
|
121
121
|
- This surfaces issues visible only on slower connections/devices.
|
|
@@ -20,10 +20,10 @@ This skill provides expert guidance and workflows for finding, diagnosing, and f
|
|
|
20
20
|
|
|
21
21
|
When investigating a frontend web application memory leak, utilize the `chrome-devtools-mcp` tools to interact with the application and take snapshots.
|
|
22
22
|
|
|
23
|
-
- Use tools like `click`, `navigate_page`, `fill`, etc
|
|
23
|
+
- Use page-scoped tools like `click`, `navigate_page`, `fill`, etc. (specifying `pageId`) to manipulate the page into the desired state.
|
|
24
24
|
- Revert the page back to the original state after interactions to see if memory is released.
|
|
25
25
|
- Repeat the same user interactions 10 times to amplify the leak.
|
|
26
|
-
- Use `take_heapsnapshot` to save `.heapsnapshot` files to disk at baseline, target (after actions), and final (after reverting actions) states.
|
|
26
|
+
- Use `take_heapsnapshot` (with `pageId`) to save `.heapsnapshot` files to disk at baseline, target (after actions), and final (after reverting actions) states.
|
|
27
27
|
|
|
28
28
|
### 2. Comparing Snapshots
|
|
29
29
|
|
|
@@ -60,6 +60,7 @@ Identify other error messages from the failed tool call or the MCP initializatio
|
|
|
60
60
|
|
|
61
61
|
- `Target closed`
|
|
62
62
|
- "Tool not found" (check if they are using `--slim` which only enables navigation and screenshot tools).
|
|
63
|
+
- Missing `pageId`: Page-scoped tools require a `pageId` argument. Call `list_pages` to find active page IDs.
|
|
63
64
|
- `ProtocolError: Network.enable timed out` or `The socket connection was closed unexpectedly`
|
|
64
65
|
- `Error [ERR_MODULE_NOT_FOUND]: Cannot find module`
|
|
65
66
|
- Any sandboxing or host validation errors.
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Converts a given string to snake_case.
|
|
8
|
-
* This function handles camelCase, PascalCase, and acronyms, including transitions between letters and numbers.
|
|
9
|
-
* It uses Unicode-aware regular expressions (`\p{L}`, `\p{N}`, `\p{Lu}`, `\p{Ll}` with the `u` flag)
|
|
10
|
-
* to correctly process letters and numbers from various languages.
|
|
11
|
-
*
|
|
12
|
-
* @param text The input string to convert to snake_case.
|
|
13
|
-
* @returns The snake_case version of the input string.
|
|
14
|
-
*/
|
|
15
|
-
export function toSnakeCase(text) {
|
|
16
|
-
if (!text) {
|
|
17
|
-
return '';
|
|
18
|
-
}
|
|
19
|
-
// First, handle case-based transformations to insert underscores correctly.
|
|
20
|
-
// 1. Add underscore between a letter and a number.
|
|
21
|
-
// e.g., "version2" -> "version_2"
|
|
22
|
-
// 2. Add underscore between an uppercase letter sequence and a following uppercase+lowercase sequence.
|
|
23
|
-
// e.g., "APIFlags" -> "API_Flags"
|
|
24
|
-
// 3. Add underscore between a lowercase/number and an uppercase letter.
|
|
25
|
-
// e.g., "lastName" -> "last_Name", "version_2Update" -> "version_2_Update"
|
|
26
|
-
// 4. Replace sequences of non-alphanumeric with a single underscore
|
|
27
|
-
// 5. Remove any leading or trailing underscores.
|
|
28
|
-
const result = text
|
|
29
|
-
.replace(/(\p{L})(\p{N})/gu, '$1_$2') // 1
|
|
30
|
-
.replace(/(\p{Lu}+)(\p{Lu}\p{Ll})/gu, '$1_$2') // 2
|
|
31
|
-
.replace(/(\p{Ll}|\p{N})(\p{Lu})/gu, '$1_$2') // 3
|
|
32
|
-
.toLowerCase()
|
|
33
|
-
.replace(/[^\p{L}\p{N}]+/gu, '_') // 4
|
|
34
|
-
.replace(/^_|_$/g, ''); // 5
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=string.js.map
|