feat: support saving snapshots to file#463
Merged
Merged
Conversation
0dc113d to
f121016
Compare
Lightning00Blade
approved these changes
Oct 24, 2025
2014ec9 to
aa8bcc0
Compare
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
aa8bcc0 to
f04d13a
Compare
OrKoN
pushed a commit
that referenced
this pull request
Nov 5, 2025
🤖 I have created a release *beep* *boop* --- ## [0.10.0](chrome-devtools-mcp-v0.9.0...chrome-devtools-mcp-v0.10.0) (2025-11-05) ### 🎉 Features * add a press_key tool ([#458](#458)) ([b427392](b427392)) * add insightSetId to performance_analyze_insight ([#518](#518)) ([36504d2](36504d2)) * an option to ignore cache on reload ([#485](#485)) ([8e56307](8e56307)) * detect network requests inspected in DevTools UI ([#477](#477)) ([796aed7](796aed7)) * fetch DOM node selected in the DevTools Elements panel ([#486](#486)) ([4a83574](4a83574)) * support page reload ([#462](#462)) ([d177087](d177087)) * support saving snapshots to file ([#463](#463)) ([b0ce08a](b0ce08a)) ### 🛠️ Fixes * Augment fix to prevent stray OGS frames in NTP from causing hangs. ([#521](#521)) ([d90abd4](d90abd4)) * improve get_network_request description ([#500](#500)) ([2f448e8](2f448e8)) * work around NTP iframes causing hangs ([#504](#504)) ([cca5ff4](cca5ff4)) ### 📄 Documentation * add Windsurf to the editor config README ([#493](#493)) ([63a5d82](63a5d82)) * fix typos in README.md exlcude -> exclude ([#513](#513)) ([8854a34](8854a34)) * remove unnecessary replace ([#475](#475)) ([40e1753](40e1753)) ### ♻️ Chores * connect to DevTools targets by default ([#466](#466)) ([a41e440](a41e440)) * detect DevTools page for each page ([#467](#467)) ([1560ff2](1560ff2)) * merge emulate tools into one ([#494](#494)) ([c06f452](c06f452)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
franco-bianco
pushed a commit
to franco-bianco/ghostframe-mcp
that referenced
this pull request
May 2, 2026
🤖 I have created a release *beep* *boop* --- ## [0.10.0](ChromeDevTools/chrome-devtools-mcp@chrome-devtools-mcp-v0.9.0...chrome-devtools-mcp-v0.10.0) (2025-11-05) ### 🎉 Features * add a press_key tool ([#458](ChromeDevTools/chrome-devtools-mcp#458)) ([d3cfa71](ChromeDevTools/chrome-devtools-mcp@d3cfa71)) * add insightSetId to performance_analyze_insight ([#518](ChromeDevTools/chrome-devtools-mcp#518)) ([d5d48f4](ChromeDevTools/chrome-devtools-mcp@d5d48f4)) * an option to ignore cache on reload ([#485](ChromeDevTools/chrome-devtools-mcp#485)) ([69948dc](ChromeDevTools/chrome-devtools-mcp@69948dc)) * detect network requests inspected in DevTools UI ([#477](ChromeDevTools/chrome-devtools-mcp#477)) ([d387517](ChromeDevTools/chrome-devtools-mcp@d387517)) * fetch DOM node selected in the DevTools Elements panel ([#486](ChromeDevTools/chrome-devtools-mcp#486)) ([246b513](ChromeDevTools/chrome-devtools-mcp@246b513)) * support page reload ([#462](ChromeDevTools/chrome-devtools-mcp#462)) ([60f4039](ChromeDevTools/chrome-devtools-mcp@60f4039)) * support saving snapshots to file ([#463](ChromeDevTools/chrome-devtools-mcp#463)) ([a89dd2b](ChromeDevTools/chrome-devtools-mcp@a89dd2b)) ### 🛠️ Fixes * Augment fix to prevent stray OGS frames in NTP from causing hangs. ([#521](ChromeDevTools/chrome-devtools-mcp#521)) ([d0f212a](ChromeDevTools/chrome-devtools-mcp@d0f212a)) * improve get_network_request description ([#500](ChromeDevTools/chrome-devtools-mcp#500)) ([fa27910](ChromeDevTools/chrome-devtools-mcp@fa27910)) * work around NTP iframes causing hangs ([#504](ChromeDevTools/chrome-devtools-mcp#504)) ([0813338](ChromeDevTools/chrome-devtools-mcp@0813338)) ### 📄 Documentation * add Windsurf to the editor config README ([#493](ChromeDevTools/chrome-devtools-mcp#493)) ([58af5d8](ChromeDevTools/chrome-devtools-mcp@58af5d8)) * fix typos in README.md exlcude -> exclude ([#513](ChromeDevTools/chrome-devtools-mcp#513)) ([1ac6745](ChromeDevTools/chrome-devtools-mcp@1ac6745)) * remove unnecessary replace ([#475](ChromeDevTools/chrome-devtools-mcp#475)) ([62d0b19](ChromeDevTools/chrome-devtools-mcp@62d0b19)) ### ♻️ Chores * connect to DevTools targets by default ([#466](ChromeDevTools/chrome-devtools-mcp#466)) ([9779c2d](ChromeDevTools/chrome-devtools-mcp@9779c2d)) * detect DevTools page for each page ([#467](ChromeDevTools/chrome-devtools-mcp#467)) ([2bd33b9](ChromeDevTools/chrome-devtools-mcp@2bd33b9)) * merge emulate tools into one ([#494](ChromeDevTools/chrome-devtools-mcp#494)) ([08852c1](ChromeDevTools/chrome-devtools-mcp@08852c1)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
pull Bot
pushed a commit
to Mu-L/chrome-devtools-mcp
that referenced
this pull request
May 14, 2026
## Summary Adds an optional `filePath` parameter to `evaluate_script` that saves the script output to a file instead of returning it inline. Refs #153 ## Motivation Issue #153 requested `filePath` support for `take_snapshot` and `evaluate_script`. `take_snapshot` was addressed in ChromeDevTools#463. PR ChromeDevTools#248 previously attempted this but was closed due to conflicts. This PR implements the same feature on the current codebase, completing the remaining piece. ## Changes - Add optional `filePath` parameter to the `evaluate_script` schema - Add `context.validatePath(filePath)` call for path validation - Pass `{filePath, context}` options to `performEvaluation()` - In `performEvaluation()`: when `filePath` is provided, save output via `context.saveFile()` with `.json` extension; otherwise return inline as before - Update `docs/tool-reference.md` via `npm run docs:generate` - Add unit test for file output ## Key design decisions - **Same pattern as existing tools**: Follows the `context.saveFile()` pattern established by `take_snapshot` (ChromeDevTools#463), `take_screenshot`, `get_network_request` (ChromeDevTools#795), and performance tools (ChromeDevTools#686). - **Minimal change surface**: Only `performEvaluation()` gains an optional `options` parameter. No new interfaces or abstractions. - **Backwards compatible**: `filePath` is optional. When omitted, behavior is identical to before. ## Testing **Unit test added** (`tests/tools/script.test.ts`): - Call `evaluate_script` with `filePath` set to a temp file - Assert response contains "Output saved to" - Assert file content matches the JSON-serialized return value - Clean up temp file in `finally` block **Manual testing performed**: - `() => document.title` with `filePath: /tmp/test.json` → file contains `"Example Domain"` - `() => document.title` without `filePath` → inline ```json block returned (no regression) - `() => Array.from({length: 100}, ...)` with `filePath` → 100-item array saved correctly - `filePath` pointing to non-existent directory → directory auto-created, file saved - Relative path (`test.json`) → resolved to CWD, absolute path shown in response - Function that throws → error returned, no partial file created - Existing file as `filePath` → file overwritten completely --------- Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #153