Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,23 @@ The Chrome DevTools MCP server supports the following configuration option:
- **Type:** boolean
- **Default:** `true`

- **`--screenshotFormat`/ `--screenshot-format`**
Override the default output format used by take_screenshot when the caller does not specify one. JPEG and WebP are ~3-5x smaller than PNG, which helps reduce context size in AI conversations. Unset preserves the existing default ("png").
- **Type:** string
- **Choices:** `jpeg`, `png`, `webp`

- **`--screenshotQuality`/ `--screenshot-quality`**
Override the default compression quality (0-100) used by take_screenshot for JPEG and WebP when the caller does not specify one. Lower values mean smaller files. Ignored for PNG. Unset preserves the Puppeteer default.
- **Type:** number

- **`--screenshotMaxWidth`/ `--screenshot-max-width`**
Maximum width in pixels for screenshots. If the captured image is wider, it is downscaled (preserving aspect ratio) before being returned. Reduces context size in AI conversations. Unset means no resize.
- **Type:** number

- **`--screenshotMaxHeight`/ `--screenshot-max-height`**
Maximum height in pixels for screenshots. If the captured image is taller, it is downscaled (preserving aspect ratio) before being returned. Can be combined with --screenshot-max-width; the smaller scale factor wins. Unset means no resize.
- **Type:** number

- **`--slim`**
Exposes a "slim" set of 3 tools covering navigation, script execution and screenshots only. Useful for basic browser tasks.
- **Type:** boolean
Expand Down
54 changes: 54 additions & 0 deletions src/bin/chrome-devtools-mcp-cli-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,60 @@ export const cliOptions = {
hidden: true,
describe: 'Include watchdog PID in Clearcut request headers (for testing).',
},
screenshotFormat: {
type: 'string',
description:
'Override the default output format used by take_screenshot when the caller does not specify one. JPEG and WebP are ~3-5x smaller than PNG, which helps reduce context size in AI conversations. Unset preserves the existing default ("png").',
choices: ['jpeg', 'png', 'webp'] as const,
},
screenshotQuality: {
type: 'number',
description:
'Override the default compression quality (0-100) used by take_screenshot for JPEG and WebP when the caller does not specify one. Lower values mean smaller files. Ignored for PNG. Unset preserves the Puppeteer default.',
coerce: (value: number | undefined) => {
if (value === undefined) {
return;
}
if (!Number.isInteger(value) || value < 0 || value > 100) {
throw new Error(
`Invalid screenshotQuality ${value}. Expected an integer between 0 and 100.`,
);
}
return value;
},
},
screenshotMaxWidth: {
type: 'number',
description:
'Maximum width in pixels for screenshots. If the captured image is wider, it is downscaled (preserving aspect ratio) before being returned. Reduces context size in AI conversations. Unset means no resize.',
coerce: (value: number | undefined) => {
if (value === undefined) {
return;
}
if (!Number.isInteger(value) || value <= 0) {
throw new Error(
`Invalid screenshotMaxWidth ${value}. Expected a positive integer.`,
);
}
return value;
},
},
screenshotMaxHeight: {
type: 'number',
description:
'Maximum height in pixels for screenshots. If the captured image is taller, it is downscaled (preserving aspect ratio) before being returned. Can be combined with --screenshot-max-width; the smaller scale factor wins. Unset means no resize.',
coerce: (value: number | undefined) => {
if (value === undefined) {
return;
}
if (!Number.isInteger(value) || value <= 0) {
throw new Error(
`Invalid screenshotMaxHeight ${value}. Expected a positive integer.`,
);
}
return value;
},
},
slim: {
type: 'boolean',
describe:
Expand Down
26 changes: 26 additions & 0 deletions src/telemetry/flag_usage_metrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,31 @@
{
"name": "category_experimental_third_party",
"flagType": "boolean"
},
{
"name": "screenshot_format_present",
"flagType": "boolean"
},
{
"name": "screenshot_format",
"flagType": "enum",
"choices": [
"SCREENSHOT_FORMAT_UNSPECIFIED",
"SCREENSHOT_FORMAT_JPEG",
"SCREENSHOT_FORMAT_PNG",
"SCREENSHOT_FORMAT_WEBP"
]
},
{
"name": "screenshot_quality_present",
"flagType": "boolean"
},
{
"name": "screenshot_max_width_present",
"flagType": "boolean"
},
{
"name": "screenshot_max_height_present",
"flagType": "boolean"
}
]
Loading