chrome-devtools-mcp 0.25.0 → 0.26.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.
@@ -220,10 +220,27 @@ async function fillFormElement(uid, value, context, page) {
220
220
  await selectOption(handle, aXNode, value);
221
221
  }
222
222
  else {
223
- // Increase timeout for longer input values.
224
- const timeoutPerChar = 10; // ms
225
- const fillTimeout = page.pptrPage.getDefaultTimeout() + value.length * timeoutPerChar;
226
- await handle.asLocator().setTimeout(fillTimeout).fill(value);
223
+ const isToggle = await handle.evaluate(el => {
224
+ if (el instanceof HTMLInputElement) {
225
+ return el.type === 'checkbox' || el.type === 'radio';
226
+ }
227
+ const role = el.getAttribute('role');
228
+ return role === 'checkbox' || role === 'radio' || role === 'switch';
229
+ });
230
+ if (isToggle) {
231
+ if (['true', 'false'].includes(value)) {
232
+ await handle.asLocator().fill(value === 'true');
233
+ }
234
+ else {
235
+ throw new Error(`Checkboxes, radio boxes and toggles require "true" or "false" value, but ${value} was used`);
236
+ }
237
+ }
238
+ else {
239
+ // Increase timeout for longer input values.
240
+ const timeoutPerChar = 10; // ms
241
+ const fillTimeout = page.pptrPage.getDefaultTimeout() + value.length * timeoutPerChar;
242
+ await handle.asLocator().setTimeout(fillTimeout).fill(value);
243
+ }
227
244
  }
228
245
  }
229
246
  catch (error) {
@@ -244,7 +261,9 @@ export const fill = definePageTool({
244
261
  uid: zod
245
262
  .string()
246
263
  .describe('The uid of an element on the page from the page content snapshot'),
247
- value: zod.string().describe('The value to fill in'),
264
+ value: zod
265
+ .string()
266
+ .describe('The value to fill in. "true" or "false" for checkboxes and toggles, "true" for radio buttons.'),
248
267
  includeSnapshot: includeSnapshotSchema,
249
268
  },
250
269
  blockedByDialog: true,
@@ -317,7 +336,7 @@ export const drag = definePageTool({
317
336
  });
318
337
  export const fillForm = definePageTool({
319
338
  name: 'fill_form',
320
- description: `Fill out multiple form elements at once`,
339
+ description: `Fill out multiple form elements (inputs, selects, checkboxes, radios) at once. ALWAYS prefer this tool over multiple individual 'fill' or 'click' calls when interacting with forms. It is significantly faster, more reliable, and reduces turn count. Example: Fill username, password, and check "Remember Me" in one call.`,
321
340
  annotations: {
322
341
  category: ToolCategory.INPUT,
323
342
  readOnlyHint: false,
@@ -328,7 +347,9 @@ export const fillForm = definePageTool({
328
347
  // eslint-disable-next-line @local/enforce-zod-schema
329
348
  zod.object({
330
349
  uid: zod.string().describe('The uid of the element to fill out'),
331
- value: zod.string().describe('Value for the element'),
350
+ value: zod
351
+ .string()
352
+ .describe('Value for the element. "true" or "false" for checkboxes and toggles, "true" for radio buttons.'),
332
353
  }))
333
354
  .describe('Elements from snapshot to fill out.'),
334
355
  includeSnapshot: includeSnapshotSchema,
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import path from 'node:path';
7
- import { snapshot, navigation, generateReport, zod, agenticBrowsingConfig, } from '../third_party/index.js';
7
+ import { snapshot, navigation, generateReport, zod, } from '../third_party/index.js';
8
8
  import { ToolCategory } from './categories.js';
9
9
  import { startTrace } from './performance.js';
10
10
  import { definePageTool } from './ToolDefinition.js';
@@ -67,17 +67,17 @@ export const lighthouseAudit = definePageTool({
67
67
  disabled: false,
68
68
  };
69
69
  }
70
- const options = {
71
- flags,
72
- config: agenticBrowsingConfig,
73
- };
74
70
  let result;
75
71
  try {
76
72
  if (mode === 'navigation') {
77
- result = await navigation(page.pptrPage, page.pptrPage.url(), options);
73
+ result = await navigation(page.pptrPage, page.pptrPage.url(), {
74
+ flags,
75
+ });
78
76
  }
79
77
  else {
80
- result = await snapshot(page.pptrPage, options);
78
+ result = await snapshot(page.pptrPage, {
79
+ flags,
80
+ });
81
81
  }
82
82
  if (!result) {
83
83
  throw new Error('Lighthouse audit failed.');
@@ -5,6 +5,6 @@
5
5
  */
6
6
  // If moved update release-please config
7
7
  // x-release-please-start-version
8
- export const VERSION = '0.25.0';
8
+ export const VERSION = '0.26.0';
9
9
  // x-release-please-end
10
10
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-devtools-mcp",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "MCP server for Chrome DevTools",
5
5
  "type": "module",
6
6
  "bin": {
@@ -48,7 +48,7 @@
48
48
  "mcpName": "io.github.ChromeDevTools/chrome-devtools-mcp",
49
49
  "devDependencies": {
50
50
  "@eslint/js": "^9.35.0",
51
- "@google/genai": "^1.37.0",
51
+ "@google/genai": "^2.0.1",
52
52
  "@modelcontextprotocol/sdk": "1.29.0",
53
53
  "@rollup/plugin-commonjs": "^29.0.0",
54
54
  "@rollup/plugin-json": "^6.1.0",
@@ -62,21 +62,21 @@
62
62
  "@types/yargs": "^17.0.33",
63
63
  "@typescript-eslint/eslint-plugin": "^8.43.0",
64
64
  "@typescript-eslint/parser": "^8.43.0",
65
- "chrome-devtools-frontend": "1.0.1625079",
65
+ "chrome-devtools-frontend": "1.0.1626840",
66
66
  "core-js": "3.49.0",
67
67
  "debug": "4.4.3",
68
68
  "eslint": "^9.35.0",
69
69
  "eslint-import-resolver-typescript": "^4.4.4",
70
70
  "eslint-plugin-import": "^2.32.0",
71
71
  "globals": "^17.0.0",
72
- "lighthouse": "13.2.0",
72
+ "lighthouse": "13.3.0",
73
73
  "prettier": "^3.6.2",
74
74
  "puppeteer": "24.43.0",
75
- "rollup": "4.60.2",
75
+ "rollup": "4.60.3",
76
76
  "rollup-plugin-cleanup": "^3.2.1",
77
77
  "rollup-plugin-license": "^3.6.0",
78
78
  "semver": "^7.7.4",
79
- "sinon": "^21.0.0",
79
+ "sinon": "^22.0.0",
80
80
  "typescript": "^6.0.2",
81
81
  "typescript-eslint": "^8.43.0",
82
82
  "urlpattern-polyfill": "^10.1.0",