You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mcp): add JSON Schema for MCP/CLI configuration files
Auto-generate a JSON Schema (draft-07) from config.d.ts using the
TypeScript compiler API. The schema covers all Config fields including
recursively expanded LaunchOptions and BrowserContextOptions.
- Add utils/generate_mcp_config_schema.js generator script
- Output mcp-config.schema.json alongside config.d.ts
- Register in build.js onChanges and flint for CI staleness checks
- Add config-schema.spec.ts with structural assertion tests
- Fix config.d.ts / configIni.ts drift: add saveTrace, remove dead
saveVideo, add timeouts.expect to longhandTypes
- Document $schema usage in getting-started-mcp.md and
getting-started-cli.md
Copy file name to clipboardExpand all lines: docs/src/getting-started-cli.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -275,6 +275,14 @@ playwright-cli --config path/to/config.json open example.com
275
275
276
276
The CLI also loads `.playwright/cli.config.json` automatically if present. The config file supports browser options, context options, network rules, timeouts, and more. Run `playwright-cli --help`for the full list of options.
277
277
278
+
A JSON Schema is available forIDE autocompletion. Once registered with [SchemaStore](https://www.schemastore.org/), the `.playwright/cli.config.json` file will be automatically associatedin supported editors. For other file names, add `$schema` manually:
The config file supports browser options, context options, network rules, timeouts, and more. See the [Playwright MCP repository](https://github.com/microsoft/playwright-mcp/blob/main/packages/playwright-mcp/config.d.ts) for the full schema.
188
+
The config file supports browser options, context options, network rules, timeouts, and more. See the [Playwright MCP repository](https://github.com/microsoft/playwright-mcp/blob/main/packages/playwright-mcp/config.d.ts) for the full type definition.
189
+
190
+
#### JSON Schema for IDE autocompletion
191
+
192
+
A JSON Schema is available for configuration files. Add `$schema` to your config file for IDE autocompletion and validation:
If you are using `@playwright/cli`, the project-level config at `.playwright/cli.config.json` will be automatically associated with the schema once registered with [SchemaStore](https://www.schemastore.org/).
204
+
205
+
**Note:** The JSON Schema only validates JSON config files. INI format config files use the same options but are not validated by this schema.
Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@
35
35
"lint": "npm run eslint && npm run tsc && npm run doc && npm run check-deps && node utils/generate_channels.js && node utils/generate_types/ && npm run lint-tests && npm run test-types && npm run lint-packages",
"flint": "concurrently \"npm run eslint\"\"npm run tsc\"\"npm run doc\"\"npm run check-deps\"\"node utils/generate_channels.js\"\"npm run lint-tests\"\"npm run test-types\"\"npm run lint-packages\"\"node utils/doclint/linting-code-snippets/cli.js --js-only\"",
38
+
"flint": "concurrently \"npm run eslint\"\"npm run tsc\"\"npm run doc\"\"npm run check-deps\"\"node utils/generate_channels.js\"\"node utils/generate_mcp_config_schema.js\"\"npm run lint-tests\"\"npm run test-types\"\"npm run lint-packages\"\"node utils/doclint/linting-code-snippets/cli.js --js-only\"",
* This is useful for settings options like `channel`, `headless`, `executablePath`, etc.
59
60
*/
60
61
launchOptions?: playwright.LaunchOptions;
61
62
@@ -137,6 +138,11 @@ export type Config = {
137
138
*/
138
139
saveSession?: boolean;
139
140
141
+
/**
142
+
* Whether to save the Playwright trace into the output directory.
143
+
*/
144
+
saveTrace?: boolean;
145
+
140
146
/**
141
147
* Reuse the same browser context between all connected HTTP clients.
142
148
*/
@@ -154,6 +160,11 @@ export type Config = {
154
160
*/
155
161
outputDir?: string;
156
162
163
+
/**
164
+
* Whether to save snapshots, console messages, network logs and other session logs to a file or to the standard output. Defaults to "stdout".
165
+
*/
166
+
outputMode?: 'file'|'stdout';
167
+
157
168
console?: {
158
169
/**
159
170
* The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
@@ -187,12 +198,12 @@ export type Config = {
187
198
testIdAttribute?: string;
188
199
189
200
timeouts?: {
190
-
/*
201
+
/**
191
202
* Configures default action timeout: https://playwright.dev/docs/api/class-page#page-set-default-timeout. Defaults to 5000ms.
192
203
*/
193
204
action?: number;
194
205
195
-
/*
206
+
/**
196
207
* Configures default navigation timeout: https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout. Defaults to 60000ms.
197
208
*/
198
209
navigation?: number;
@@ -204,7 +215,7 @@ export type Config = {
204
215
};
205
216
206
217
/**
207
-
* Whether to send image responses to the client. Can be "allow", "omit", or "auto". Defaults to "auto", which sends images if the client can display them.
218
+
* Whether to send image responses to the client. Defaults to "allow".
0 commit comments