script tool handles dialogs during evaluation
Introduced 2026-04-21 · score 0.92
HOW TO USE IT
When evaluating a page script that opens a browser dialog, set `dialogAction` to `accept`, `dismiss`, or a response string for `window.prompt`; it defaults to `accept`.
evaluate_script({"function":"() => { window.prompt('Enter value'); return document.title; }","dialogAction":"<accept|dismiss|prompt response>"})WHY THIS HELPS
When evaluating page scripts that trigger browser dialogs, pass a dialog action to control the dialog while the script runs.
REQUIREMENTS AND LIMITATIONS
- Version: 0.22.0
- function (required): JavaScript function declaration to execute in the selected page; return values must be JSON-serializable.
- dialogAction: Dialog handling during execution: `accept`, `dismiss`, or a string response for `window.prompt`; defaults to `accept`.
- args: Optional list of arguments to pass to the function.
FIRST-PARTY EVIDENCE
- https://github.com/ChromeDevTools/chrome-devtools-mcp/releases/tag/chrome-devtools-mcp-v0.22.0
- https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/1839
- https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/da33cb5b957fb87bbbab67e4c1521535065881f/docs/tool-reference.md
Check the installed version and the source before using it. Entry JSON