Run browser script
run_scriptBatches multiple BrowserTwin browser steps into one JavaScript script: open or resume a space, act, wait, and log the output a next step needs. Returns console output and errors.
Instructions
Run a BrowserTwin SDK script (JavaScript, top-level await; same API as btwin nodejs, see resource wwt-lite://guide or help()). Batch several steps into one script: open or resume a space, act, wait, then console.log what the next step needs (a snapshot last). Returns the console output and errors. If the output says the user has control, stop and tell the user.
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": {
"code": "<code>"
},
"name": "run_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Script body, e.g. const task = await taskSpace("goal"); const page = task.page("p1"); await page.goto("http://127.0.0.1:8080/"); console.log(await page.snapshot()); |