Skip to content

feat: Add evaluate_script_file tool to evaluate JavaScript files from… - #1772

Closed
achideal wants to merge 2 commits into
ChromeDevTools:mainfrom
achideal:feat/evaluate-script-file
Closed

achideal wants to merge 2 commits into
ChromeDevTools:mainfrom
achideal:feat/evaluate-script-file

Conversation

@achideal

Copy link
Copy Markdown
Contributor

… the local filesystem

Added a new tool evaluate_script_file that reads a JavaScript file from the local filesystem and evaluates it inside the currently selected page. This is useful for evaluating large scripts without needing to pass the entire script content as a parameter.

… the local filesystem

Added a new tool evaluate_script_file that reads a JavaScript file from the local filesystem and evaluates it inside the currently selected page. This is useful for evaluating large scripts without needing to pass the entire script content as a parameter.
@google-cla

google-cla Bot commented Mar 31, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@OrKoN

OrKoN commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Could you please file a feature request with details for your use case?

@achideal

Copy link
Copy Markdown
Contributor Author

Hi @OrKoN, thanks for the feedback! I've filed a feature request with detailed use case information here: #1775

Please let me know if you need any additional details or if there's anything I should adjust in the proposal. Happy to iterate on this!

@Lightning00Blade

Copy link
Copy Markdown
Collaborator

Closed by #2054

@OrKoN

OrKoN commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

closing as stale

@OrKoN OrKoN closed this Aug 21, 2026
Link-Start pushed a commit to Link-Start/chrome-devtools-mcp-ChromeDevTools that referenced this pull request Oct 1, 2026
## Summary
- extend `evaluate_script` with `sourcePath` for loading JavaScript from
the MCP server filesystem
- add `format: function | script` while preserving existing function
calls, output redirection, and CLI positional syntax
- validate local source paths through MCP roots and cover page, service
worker, and CLI execution

Supersedes ChromeDevTools#1772.
Fixes ChromeDevTools#1775.

## Test plan
- [x] `npm run gen`
- [x] `npm run test tests/tools/script.test.ts
tests/e2e/chrome-devtools-commands.test.ts`
- [ ] `npm run test` (feature-related tests pass; the local Windows run
has unrelated existing failures: symlink creation requires additional OS
privileges, one extension-page timeout, and the large full-page
screenshot exceeds Chrome's limit)
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.

3 participants