evaluate_script loads source code from local files
Introduced 2026-10-15 · score 0.98
HOW TO USE IT
When evaluating repository JavaScript in a target page, pass its local file path with `--sourcePath` and choose `--format` for how to interpret the source. Provide `sourcePath` or `function`, never both.
chrome-devtools evaluate_script --pageId 1 --sourcePath /path/to/script.js --format scriptWHY THIS HELPS
When evaluating repository JavaScript in a target page, load the script from a local file and select its interpretation mode.
REQUIREMENTS AND LIMITATIONS
- Version: 1.11.0
- pageId (required): Targets a specific page by ID.
- sourcePath: Absolute or relative path to a JavaScript file on the MCP server's local filesystem; provide this or `function`, but not both.
- function: JavaScript source to execute; provide this or `sourcePath`, but not both.
- format: `function` interprets source as a function declaration and supports `args`; `script` evaluates classic JavaScript and does not support `args`. Defaults to `function`; ECMAScript modules are unsupported. Values are alternatives.
- args: Optional arguments passed to the function; supported with `format: function`.
- `sourcePath` is an absolute or relative path on the MCP server's local filesystem.
- Provide either `sourcePath` or `function`, but not both.
- `function` format treats the source as a function declaration and supports args; `script` evaluates classic JavaScript and does not support args.
- ECMAScript modules are not supported.
- Returned values must be JSON-serializable.
- Local source paths are validated through MCP roots.
FIRST-PARTY EVIDENCE
- https://github.com/ChromeDevTools/chrome-devtools-mcp/releases/tag/chrome-devtools-mcp-v1.11.0
- https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/2606
- https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/9cf47a44558dd6873a2bb011d2cda73aca117833/skills/chrome-devtools-cli/SKILL.md
- https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/9cf47a44558dd6873a2bb011d2cda73aca117833/docs/tool-reference.md
Check the installed version and the source before using it. Entry JSON