Skip to content

feat: support filePath for network request and response bodies#795

Merged
OrKoN merged 1 commit into
mainfrom
orkon/network-body
Jan 19, 2026
Merged

feat: support filePath for network request and response bodies#795
OrKoN merged 1 commit into
mainfrom
orkon/network-body

Conversation

@OrKoN

@OrKoN OrKoN commented Jan 19, 2026

Copy link
Copy Markdown
Collaborator

Closes #377

@OrKoN OrKoN force-pushed the orkon/network-body branch 4 times, most recently from 978143b to 9d944a3 Compare January 19, 2026 12:10
@OrKoN OrKoN requested a review from nroscino January 19, 2026 12:11
@OrKoN OrKoN force-pushed the orkon/network-body branch from 9d944a3 to 1bea0a1 Compare January 19, 2026 12:15

@nroscino nroscino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@OrKoN OrKoN enabled auto-merge January 19, 2026 12:41
@OrKoN OrKoN added this pull request to the merge queue Jan 19, 2026
Merged via the queue into main with commit 6d0e4ca Jan 19, 2026
30 of 33 checks passed
@OrKoN OrKoN deleted the orkon/network-body branch January 19, 2026 12:48
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: Could we add BODY_CONTEXT_SIZE_LIMIT to the env, or add a param to the get_network_request?

2 participants