Skip to content

feat: support evaluating scripts from local files - #2606

Open
achideal wants to merge 1 commit into
ChromeDevTools:mainfrom
achideal:feat/evaluate-script-source-path
Open

feat: support evaluating scripts from local files#2606
achideal wants to merge 1 commit into
ChromeDevTools:mainfrom
achideal:feat/evaluate-script-source-path

Conversation

@achideal

@achideal achideal commented Aug 22, 2026

Copy link
Copy Markdown

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 #1772.
Fixes #1775.

Test plan

  • npm run gen
  • 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)

@google-cla

google-cla Bot commented Aug 22, 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.

@achideal
achideal force-pushed the feat/evaluate-script-source-path branch from 948f00c to 2616476 Compare August 22, 2026 16:33
@achideal
achideal force-pushed the feat/evaluate-script-source-path branch from 2616476 to 945ef28 Compare August 26, 2026 04:26

@cbi58105-crypto cbi58105-crypto left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary: Adds sourcePath + format to evaluate_script allowing loading local files; supports 'function' and 'script' modes; validates exactly one source and disallows args when format='script'. Tests added covering file loading and error cases. Suggestions: clarify how relative sourcePath is resolved (process.cwd vs repo root) and document file: URL handling; consider clearer error messages for unreadable paths; note ESM modules are not supported. I couldn't run tests locally due to environment (PowerShell execution policy / missing tsc).

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.

Feature: Add evaluate_script_file tool to evaluate JavaScript files from the local filesystem

2 participants