interceptor_browser_inject_init_script
Inject a JavaScript file as an init script that runs before any page script on every navigation, enabling prototype/global patches without DOM artifacts. Navigate again to apply to the current page.
Instructions
Inject a JS file as an init script (Playwright page.addInitScript). Runs before any page script on every subsequent navigation/frame. Runs in the isolated utility world — no DOM artifact; patches to shared prototypes/globals reach the page main world via utility-world sharing. Does NOT affect the currently loaded document — navigate again to apply.
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": {
"target_id": "<target_id>",
"script_path": "<script_path>"
},
"name": "interceptor_browser_inject_init_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target_id | Yes | Target ID from interceptor_browser_launch | |
| script_path | Yes | Absolute path to a .js file to inject before page scripts on every load. |