feat: support evaluating scripts from local files - #2606
Conversation
|
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. |
948f00c to
2616476
Compare
2616476 to
945ef28
Compare
cbi58105-crypto
left a comment
There was a problem hiding this comment.
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).
Summary
evaluate_scriptwithsourcePathfor loading JavaScript from the MCP server filesystemformat: function | scriptwhile preserving existing function calls, output redirection, and CLI positional syntaxSupersedes #1772.
Fixes #1775.
Test plan
npm run gennpm run test tests/tools/script.test.ts tests/e2e/chrome-devtools-commands.test.tsnpm 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)