Execute Script
executeRun custom Playwright scripts to automate complex browser interactions, handling conditional logic and loops in a single call.
Instructions
Run a Playwright script with access to { page, context }. One tool call replaces 5-20 sequential MCP round trips. Use for complex flows with conditional logic, loops, error handling. NOTE: Scripts run in the Node.js process — equivalent to arbitrary code execution. Disable with LEAP_ALLOW_EXECUTE=false.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionId": "<sessionId>",
"script": "<script>"
},
"name": "execute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | ||
| script | Yes | JavaScript async function body with access to { page, context }. Example: 'await page.goto("..."); return await page.title();' | |
| timeout | No | Timeout in ms. Default: 60000, max: 300000. |