browser_evaluate
Execute JavaScript code within browser sessions to automate web interactions, test functionality, or extract data using Playwright's isolated environments.
Instructions
Run JavaScript
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| function | Yes |
Implementation Reference
- index.js:417-422 (handler)The 'browser_evaluate' tool registration and handler implementation. It uses 'proxyToolCall' to forward the request to an underlying browser instance.
server.tool('browser_evaluate', 'Run JavaScript', { function: z.string() }, async (args) => { const check = requireActivePage(); if (check) return check; return proxyToolCall('browser_evaluate', args); });