Skip to main content
Glama

interceptor_browser_evaluate

Run a JavaScript file inside a page's isolated utility world and retrieve its return value. Enables invisible DOM reads and page-safe testing without altering page scripts.

Instructions

Execute a JS file in the page and return its result. Source is loaded from script_path (absolute path). The file body is wrapped in an arrow function receiving __args (so the file may return value; directly and access the optional args object). Runs in Playwright's isolated utility world (different window, same DOM). Reads are invisible to the page; mutations to shared prototypes/globals are observable by page scripts. For main-world patching use interceptor_browser_inject_init_script. Rate-limit before reCAPTCHA: each call emits CDP traffic that behavioural scorers count.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNoOptional JSON-serialisable args object, available inside the script as `__args`.
target_idYesTarget ID from interceptor_browser_launch
script_pathYesAbsolute path to a .js file. File body is the function body; use `return` to send a value back.
value_max_charsNoMax characters of the JSON-stringified return value (default: 20000, max 16000000).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv3.5.3
    • changedInput schema / properties / target_id / description
      Previous value: -"Target ID from interceptor_browser_launch or interceptor_camoufox_launch"New value: +"Target ID from interceptor_browser_launch"
    • changedInput schema / properties / value_max_chars / description
      Previous value: -"Max characters of the JSON-stringified return value (default: 20000)."New value: +"Max characters of the JSON-stringified return value (default: 20000, max 16000000)."
    • removedInput schema / properties / world
      Removed value: -{
      -  "default": "isolated",
      -  "description": "`isolated` (default) or `main`. On current camoufox build (cloverlabs/FF150) both run in the page's main world — arg is accepted but has no observable effect.",
      -  "enum": [
      -    "isolated",
      -    "main"
      -  ],
      -  "type": "string"
      -}
  2. Changed1 schema field changedv3.3.0
    • changedInput schema / properties / world / description
      Previous value: -"`isolated` (default) or `main`. Main world only works on camoufox with `main_world_eval: true`."New value: +"`isolated` (default) or `main`. On current camoufox build (cloverlabs/FF150) both run in the page's main world — arg is accepted but has no observable effect."
  3. Addedv3.2.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses the isolated utility world, that reads are invisible, that mutations to shared prototypes/globals are observable, and that each call emits CDP traffic counted by behavioral scorers. It does not cover error handling or return format explicitly, but the schema hints at JSON-stringified results. This is above-average transparency.

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

Conciseness4/5

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

The description is concise and front-loaded with the core purpose. Each sentence adds value: execution, wrapping, isolation, visibility, alternative, and rate-limit caution. It could be slightly trimmed, but nothing is wasteful.

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

Completeness4/5

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

Given the complexity of browser JS execution and the lack of an output schema, the description covers key aspects: isolation, return mechanism, and an important usage constraint (rate limiting). It doesn't detail error scenarios or exact return formatting, but the schema for value_max_chars implies JSON-stringified output. Overall, sufficient for correct invocation.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description adds meaningful context beyond the schema: the file body is wrapped in an arrow function and can return a value via `return`, and args are available as `__args`. These details explain how the parameters are used, exceeding the schema's basic descriptions.

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 states a specific verb+resource ('Execute a JS file in the page and return its result') and distinguishes itself from the main-world patching tool by naming interceptor_browser_inject_init_script as the alternative for that use case. It clearly identifies what the tool does and what it is not for.

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

Usage Guidelines4/5

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

The description explicitly directs the agent to use interceptor_browser_inject_init_script for main-world patching, which implies this tool is for the isolated utility world. It also warns about rate-limiting before reCAPTCHA. It doesn't cover all alternative tools (like add_script_tag), but the most relevant distinction is made.

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

Deploy Server

Other Tools