Skip to content

Commit 81cbd99

Browse files
authored
docs: enhance cli docs + sort required vs opt params (#674)
1 parent 807bbcc commit 81cbd99

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
@@ -350,20 +350,20 @@ The Chrome DevTools MCP server supports the following configuration option:
350350

351351
<!-- BEGIN AUTO GENERATED OPTIONS -->
352352

353-
- **`--autoConnect`**
353+
- **`--autoConnect`/ `--auto-connect`**
354354
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.
355355
- **Type:** boolean
356356
- **Default:** `false`
357357

358-
- **`--browserUrl`, `-u`**
358+
- **`--browserUrl`/ `--browser-url`, `-u`**
359359
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.
360360
- **Type:** string
361361

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

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

@@ -372,15 +372,15 @@ The Chrome DevTools MCP server supports the following configuration option:
372372
- **Type:** boolean
373373
- **Default:** `false`
374374

375-
- **`--executablePath`, `-e`**
375+
- **`--executablePath`/ `--executable-path`, `-e`**
376376
Path to custom Chrome executable.
377377
- **Type:** string
378378

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

383-
- **`--userDataDir`**
383+
- **`--userDataDir`/ `--user-data-dir`**
384384
Path to the user data directory for Chrome. Default is $HOME/.cache/chrome-devtools-mcp/chrome-profile$CHANNEL_SUFFIX_IF_NON_STABLE
385385
- **Type:** string
386386

@@ -389,37 +389,37 @@ The Chrome DevTools MCP server supports the following configuration option:
389389
- **Type:** string
390390
- **Choices:** `stable`, `canary`, `beta`, `dev`
391391

392-
- **`--logFile`**
392+
- **`--logFile`/ `--log-file`**
393393
Path to a file to write debug logs to. Set the env variable `DEBUG` to `*` to enable verbose logs. Useful for submitting bug reports.
394394
- **Type:** string
395395

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

400-
- **`--proxyServer`**
400+
- **`--proxyServer`/ `--proxy-server`**
401401
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.
402402
- **Type:** string
403403

404-
- **`--acceptInsecureCerts`**
404+
- **`--acceptInsecureCerts`/ `--accept-insecure-certs`**
405405
If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.
406406
- **Type:** boolean
407407

408-
- **`--chromeArg`**
408+
- **`--chromeArg`/ `--chrome-arg`**
409409
Additional arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.
410410
- **Type:** array
411411

412-
- **`--categoryEmulation`**
412+
- **`--categoryEmulation`/ `--category-emulation`**
413413
Set to false to exclude tools related to emulation.
414414
- **Type:** boolean
415415
- **Default:** `true`
416416

417-
- **`--categoryPerformance`**
417+
- **`--categoryPerformance`/ `--category-performance`**
418418
Set to false to exclude tools related to performance.
419419
- **Type:** boolean
420420
- **Default:** `true`
421421

422-
- **`--categoryNetwork`**
422+
- **`--categoryNetwork`/ `--category-network`**
423423
Set to false to exclude tools related to network.
424424
- **Type:** boolean
425425
- **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)