evaluate_script
Execute a JavaScript function in the current page and return its result. Accepts element UIDs as arguments and can save output to a JSON file.
Instructions
Execute JS function in page. Prefer UID tools for interactions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | UIDs to pass as function arguments | |
| saveTo | No | Save the result to a file as JSON instead of returning it inline. Pass a file path, an existing directory (generated file inside), or true (generated file under ~/.firefox-devtools-mcp/output/). Relative paths resolve against the current working directory. | |
| preview | No | Number of characters of the saved result to return inline as a preview when saveTo is used. Omit for no preview. | |
| timeout | No | Timeout in ms (default: 5000) | |
| function | Yes | JS function string, e.g. () => document.title |