Run Playwright code (unsafe)
browser_run_code_unsafeRun custom Python Playwright code for advanced browser automation. Execute arbitrary scripts in the server process when built-in actions are insufficient.
Instructions
Run a Python Playwright code snippet. Unsafe: executes arbitrary Python in the Playwright server process with normal builtins/imports and is RCE-equivalent.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "browser_run_code_unsafe"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Python Playwright code to execute. It may define an async function or provide statements that run with page in scope. | |
| _meta | No | ||
| filename | No | Load code from the specified file. If both code and filename are provided, code will be ignored. |