Skip to main content
Glama

interceptor_browser_inject_init_script

Inject a JavaScript file that runs before every page script on each navigation, enabling early modification of the browser environment for automation or testing.

Instructions

Inject a JS file as an init script (Playwright page.addInitScript). Runs before any page script on every subsequent navigation/frame. Cloakbrowser (Chromium): runs in the isolated utility world — no DOM artifact; patches to shared prototypes/globals reach the page main world via utility-world sharing. Camoufox (cloverlabs/FF150): runs directly in the page's main world. Patches (e.g. Object.defineProperty(navigator, 'webdriver', ...)) DO apply to the page, but are observable by anti-bot code on the page (Function.prototype.toString leak applies). For Camoufox stealth, prefer source-level fingerprint config at launch (os, webgl_config, fonts, humanize, …) over JS injection. Earlier daijro/FF135 ran init scripts in a Juggler scope that did NOT reach the page (camoufox#48); cloverlabs/FF150 removed that scope. Does NOT affect the currently loaded document — navigate again to apply.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_idYesTarget ID from interceptor_browser_launch or interceptor_camoufox_launch
script_pathYesAbsolute path to a .js file to inject before page scripts on every load.
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description fully carries the burden. It details execution contexts: for Chromium, runs in isolated utility world with shared prototypes; for Firefox, runs directly in page main world with observable patches (e.g., Function.prototype.toString leak). Also covers historical changes (FF135 vs FF150). Provides comprehensive behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise yet thorough, front-loading the core purpose and then providing engine-specific details, caveats, and alternatives. Every sentence adds value without redundancy. Well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and no annotations, the description covers all necessary contextual aspects: execution behavior on different engines, version differences, recommendation against use for certain cases, and the need for navigation to apply. An agent can fully understand when and how to use this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% (both parameters documented). The description adds no additional meaning beyond what the schema already provides for the parameters. The behavioral context about injection timing and world scope is valuable but pertains to the tool's operation, not parameter semantics. Thus baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool injects a JS file as an init script via Playwright's addInitScript, runs before any page script on every navigation/frame. It distinguishes between Cloakbrowser (Chromium) and Camoufox (Firefox) behaviors, and differentiates from sibling tools like interceptor_camoufox_launch or interceptor_browser_add_script_tag by specifying the execution context and when to prefer alternative approaches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly advises when to use and when not: for Camoufox, suggests using source-level fingerprint config at launch over JS injection due to observability. Notes that init scripts do not affect the currently loaded document, requiring navigation to apply. Also mentions legacy behavior in daijro/FF135, guiding the agent away from this tool in that context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yfe404/proxy-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server