Skip to content

Commit f3ef694

Browse files
authored
Merge pull request #3 from ChromeDevTools/main
docs: enhance cli docs + sort required vs opt params (ChromeDevTools#674)
2 parents fa8608e + 81cbd99 commit f3ef694

File tree

3 files changed

+35
-19
lines changed

3 files changed

+35
-19
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -353,20 +353,20 @@ The Chrome DevTools MCP server supports the following configuration option:
353353

354354
<!-- BEGIN AUTO GENERATED OPTIONS -->
355355

356-
- **`--autoConnect`**
356+
- **`--autoConnect`/ `--auto-connect`**
357357
If specified, automatically connects to a browser (Chrome 145+) running in the user data directory identified by the channel param. Requires remote debugging being enabled in Chrome here: chrome://inspect/#remote-debugging.
358358
- **Type:** boolean
359359
- **Default:** `false`
360360

361-
- **`--browserUrl`, `-u`**
361+
- **`--browserUrl`/ `--browser-url`, `-u`**
362362
Connect to a running, debuggable Chrome instance (e.g. `http://127.0.0.1:9222`). For more details see: https://github.com/ChromeDevTools/chrome-devtools-mcp#connecting-to-a-running-chrome-instance.
363363
- **Type:** string
364364

365-
- **`--wsEndpoint`, `-w`**
365+
- **`--wsEndpoint`/ `--ws-endpoint`, `-w`**
366366
WebSocket endpoint to connect to a running Chrome instance (e.g., ws://127.0.0.1:9222/devtools/browser/<id>). Alternative to --browserUrl.
367367
- **Type:** string
368368

369-
- **`--wsHeaders`**
369+
- **`--wsHeaders`/ `--ws-headers`**
370370
Custom headers for WebSocket connection in JSON format (e.g., '{"Authorization":"Bearer token"}'). Only works with --wsEndpoint.
371371
- **Type:** string
372372

@@ -375,15 +375,15 @@ The Chrome DevTools MCP server supports the following configuration option:
375375
- **Type:** boolean
376376
- **Default:** `false`
377377

378-
- **`--executablePath`, `-e`**
378+
- **`--executablePath`/ `--executable-path`, `-e`**
379379
Path to custom Chrome executable.
380380
- **Type:** string
381381

382382
- **`--isolated`**
383383
If specified, creates a temporary user-data-dir that is automatically cleaned up after the browser is closed. Defaults to false.
384384
- **Type:** boolean
385385

386-
- **`--userDataDir`**
386+
- **`--userDataDir`/ `--user-data-dir`**
387387
Path to the user data directory for Chrome. Default is $HOME/.cache/chrome-devtools-mcp/chrome-profile$CHANNEL_SUFFIX_IF_NON_STABLE
388388
- **Type:** string
389389

@@ -392,37 +392,37 @@ The Chrome DevTools MCP server supports the following configuration option:
392392
- **Type:** string
393393
- **Choices:** `stable`, `canary`, `beta`, `dev`
394394

395-
- **`--logFile`**
395+
- **`--logFile`/ `--log-file`**
396396
Path to a file to write debug logs to. Set the env variable `DEBUG` to `*` to enable verbose logs. Useful for submitting bug reports.
397397
- **Type:** string
398398

399399
- **`--viewport`**
400400
Initial viewport size for the Chrome instances started by the server. For example, `1280x720`. In headless mode, max size is 3840x2160px.
401401
- **Type:** string
402402

403-
- **`--proxyServer`**
403+
- **`--proxyServer`/ `--proxy-server`**
404404
Proxy server configuration for Chrome passed as --proxy-server when launching the browser. See https://www.chromium.org/developers/design-documents/network-settings/ for details.
405405
- **Type:** string
406406

407-
- **`--acceptInsecureCerts`**
407+
- **`--acceptInsecureCerts`/ `--accept-insecure-certs`**
408408
If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.
409409
- **Type:** boolean
410410

411-
- **`--chromeArg`**
411+
- **`--chromeArg`/ `--chrome-arg`**
412412
Additional arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.
413413
- **Type:** array
414414

415-
- **`--categoryEmulation`**
415+
- **`--categoryEmulation`/ `--category-emulation`**
416416
Set to false to exclude tools related to emulation.
417417
- **Type:** boolean
418418
- **Default:** `true`
419419

420-
- **`--categoryPerformance`**
420+
- **`--categoryPerformance`/ `--category-performance`**
421421
Set to false to exclude tools related to performance.
422422
- **Type:** boolean
423423
- **Default:** `true`
424424

425-
- **`--categoryNetwork`**
425+
- **`--categoryNetwork`/ `--category-network`**
426426
Set to false to exclude tools related to network.
427427
- **Type:** boolean
428428
- **Default:** `true`

docs/tool-reference.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343

4444
**Parameters:**
4545

46-
- **dblClick** (boolean) _(optional)_: Set to true for double clicks. Default is false.
4746
- **uid** (string) **(required)**: The uid of an element on the page from the page content snapshot
47+
- **dblClick** (boolean) _(optional)_: Set to true for double clicks. Default is false.
4848

4949
---
5050

@@ -161,8 +161,8 @@
161161

162162
**Parameters:**
163163

164-
- **timeout** (integer) _(optional)_: Maximum wait time in milliseconds. If set to 0, the default timeout will be used.
165164
- **url** (string) **(required)**: URL to load in a new page.
165+
- **timeout** (integer) _(optional)_: Maximum wait time in milliseconds. If set to 0, the default timeout will be used.
166166

167167
---
168168

@@ -172,8 +172,8 @@
172172

173173
**Parameters:**
174174

175-
- **bringToFront** (boolean) _(optional)_: Whether to focus the page and bring it to the top.
176175
- **pageIdx** (number) **(required)**: The index of the page to select. Call [`list_pages`](#list_pages) to get available pages.
176+
- **bringToFront** (boolean) _(optional)_: Whether to focus the page and bring it to the top.
177177

178178
---
179179

@@ -279,7 +279,6 @@ so returned values have to JSON-serializable.
279279

280280
**Parameters:**
281281

282-
- **args** (array) _(optional)_: An optional list of arguments to pass to the function.
283282
- **function** (string) **(required)**: A JavaScript function declaration to be executed by the tool in the currently selected page.
284283
Example without arguments: `() => {
285284
return document.title
@@ -290,6 +289,8 @@ so returned values have to JSON-serializable.
290289
return el.innerText;
291290
}`
292291

292+
- **args** (array) _(optional)_: An optional list of arguments to pass to the function.
293+
293294
---
294295

295296
### `get_console_message`

scripts/generate-docs.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,17 @@ function generateConfigOptionsMarkdown(): string {
141141
const aliasText = optionConfig.alias ? `, \`-${optionConfig.alias}\`` : '';
142142
const description = optionConfig.description || optionConfig.describe || '';
143143

144+
// Convert camelCase to dash-case
145+
const dashCaseName = optionName
146+
.replace(/([a-z])([A-Z])/g, '$1-$2')
147+
.toLowerCase();
148+
const nameDisplay =
149+
dashCaseName !== optionName
150+
? `\`--${optionName}\`/ \`--${dashCaseName}\``
151+
: `\`--${optionName}\``;
152+
144153
// Start with option name and description
145-
markdown += `- **\`--${optionName}\`${aliasText}**\n`;
154+
markdown += `- **${nameDisplay}${aliasText}**\n`;
146155
markdown += ` ${description}\n`;
147156

148157
// Add type information
@@ -365,7 +374,13 @@ async function generateToolDocumentation(): Promise<void> {
365374

366375
markdown += '**Parameters:**\n\n';
367376

368-
const propertyNames = Object.keys(properties).sort();
377+
const propertyNames = Object.keys(properties).sort((a, b) => {
378+
const aRequired = required.includes(a);
379+
const bRequired = required.includes(b);
380+
if (aRequired && !bRequired) return -1;
381+
if (!aRequired && bRequired) return 1;
382+
return a.localeCompare(b);
383+
});
369384
for (const propName of propertyNames) {
370385
const prop = properties[propName] as TypeInfo;
371386
const isRequired = required.includes(propName);

0 commit comments

Comments
 (0)