feat: support filePath for network request and response bodies#795
Merged
Conversation
978143b to
9d944a3
Compare
9d944a3 to
1bea0a1
Compare
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Jan 27, 2026
🤖 I have created a release *beep* *boop* --- ## [0.14.0](chrome-devtools-mcp-v0.13.0...chrome-devtools-mcp-v0.14.0) (2026-01-27) ### 🎉 Features * add a skill for using chrome-devtools-mcp ([#830](#830)) ([aa0a367](aa0a367)) * add background parameter to new_page tool ([#837](#837)) ([d756888](d756888)) * allow skipping snapshot generation for input tools ([#821](#821)) ([4b8e9f2](4b8e9f2)) * include stack trace in 'get_console_message' tool ([#740](#740)) ([a3a0021](a3a0021)) * support device viewport and user agent emulation ([#798](#798)) ([a816967](a816967)) * support filePath for network request and response bodies ([#795](#795)) ([6d0e4ca](6d0e4ca)) ### 🛠️ Fixes * handle beforeunload dialogs in navigations ([#788](#788)) ([9b21f8b](9b21f8b)) * improve error handling for console messages ([#844](#844)) ([dc43ede](dc43ede)) * improve error reporting when retrieving the element ([#845](#845)) ([f7dd003](f7dd003)) * improve performance tool description ([#800](#800)) ([aa9a176](aa9a176)) * increase timeouts for long text input ([#787](#787)) ([a83a338](a83a338)) * make request and response handling more robust ([#846](#846)) ([695817f](695817f)) * re-use node ids across snapshots ([#814](#814)) ([a6cd2cd](a6cd2cd)) ### 📄 Documentation * add a mention of evals into contributing.md ([#773](#773)) ([9a31ac7](9a31ac7)) * document how to add extensions to gemini-cli ([#834](#834)) ([0610d11](0610d11)) * update auto-connect docs ([#779](#779)) ([a106fba](a106fba)) * Update README.md to include a link to Android debugging ([#783](#783)) ([6e52e66](6e52e66)) --- 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.14.0](ChromeDevTools/chrome-devtools-mcp@chrome-devtools-mcp-v0.13.0...chrome-devtools-mcp-v0.14.0) (2026-01-27) ### 🎉 Features * add a skill for using chrome-devtools-mcp ([#830](ChromeDevTools/chrome-devtools-mcp#830)) ([7f7a378](ChromeDevTools/chrome-devtools-mcp@7f7a378)) * add background parameter to new_page tool ([#837](ChromeDevTools/chrome-devtools-mcp#837)) ([634c28c](ChromeDevTools/chrome-devtools-mcp@634c28c)) * allow skipping snapshot generation for input tools ([#821](ChromeDevTools/chrome-devtools-mcp#821)) ([2b5fb11](ChromeDevTools/chrome-devtools-mcp@2b5fb11)) * include stack trace in 'get_console_message' tool ([#740](ChromeDevTools/chrome-devtools-mcp#740)) ([4ea4915](ChromeDevTools/chrome-devtools-mcp@4ea4915)) * support device viewport and user agent emulation ([#798](ChromeDevTools/chrome-devtools-mcp#798)) ([d3571f0](ChromeDevTools/chrome-devtools-mcp@d3571f0)) * support filePath for network request and response bodies ([#795](ChromeDevTools/chrome-devtools-mcp#795)) ([f343a1d](ChromeDevTools/chrome-devtools-mcp@f343a1d)) ### 🛠️ Fixes * handle beforeunload dialogs in navigations ([#788](ChromeDevTools/chrome-devtools-mcp#788)) ([63203c8](ChromeDevTools/chrome-devtools-mcp@63203c8)) * improve error handling for console messages ([#844](ChromeDevTools/chrome-devtools-mcp#844)) ([31335d0](ChromeDevTools/chrome-devtools-mcp@31335d0)) * improve error reporting when retrieving the element ([#845](ChromeDevTools/chrome-devtools-mcp#845)) ([4293b9e](ChromeDevTools/chrome-devtools-mcp@4293b9e)) * improve performance tool description ([#800](ChromeDevTools/chrome-devtools-mcp#800)) ([7ad3b38](ChromeDevTools/chrome-devtools-mcp@7ad3b38)) * increase timeouts for long text input ([#787](ChromeDevTools/chrome-devtools-mcp#787)) ([776712a](ChromeDevTools/chrome-devtools-mcp@776712a)) * make request and response handling more robust ([#846](ChromeDevTools/chrome-devtools-mcp#846)) ([7c54db7](ChromeDevTools/chrome-devtools-mcp@7c54db7)) * re-use node ids across snapshots ([#814](ChromeDevTools/chrome-devtools-mcp#814)) ([4770d4d](ChromeDevTools/chrome-devtools-mcp@4770d4d)) ### 📄 Documentation * add a mention of evals into contributing.md ([#773](ChromeDevTools/chrome-devtools-mcp#773)) ([805f7cb](ChromeDevTools/chrome-devtools-mcp@805f7cb)) * document how to add extensions to gemini-cli ([#834](ChromeDevTools/chrome-devtools-mcp#834)) ([8fedcc0](ChromeDevTools/chrome-devtools-mcp@8fedcc0)) * update auto-connect docs ([#779](ChromeDevTools/chrome-devtools-mcp#779)) ([fef39df](ChromeDevTools/chrome-devtools-mcp@fef39df)) * Update README.md to include a link to Android debugging ([#783](ChromeDevTools/chrome-devtools-mcp#783)) ([60a1461](ChromeDevTools/chrome-devtools-mcp@60a1461)) --- 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.
Closes #377