Skip to main content
Glama

browser_eval

Destructive

Evaluates JavaScript in a page or iframe to run targeted browser logic and inspect returned results. Use it for custom interactions or checks; prefer read-only DOM/text tools for extraction.

Instructions

Evaluate JS in page/iframe. Prefer read-only browser_dom(fields) or browser_text(main_only=true) for extraction; avoid fetch().

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_eval"
  }
}

Input Schema

NameRequiredDescriptionDefault
tabNoTab index string (e.g. '0'), targetId, or URL/title substring.
codeNoJS expression.
fileNoLocal JS file path.
frameNoIframe #fN, id, URL substring, or 'any'.
allow_networkNoSilence fetch/XHR/WS warning.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.1

TDQS

A4/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false, and openWorldHint=true, so the description only needs to add context. "Avoid fetch()" hints at the network side-effect warning surfaced by allow_network, but the description never says what arbitrary JS can mutate or destroy on the page, which is the key risk for a destructive tool.

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?

Two short sentences with no filler, and the primary purpose is front-loaded before the alternative routing. The telegraphic phrasing ("browser_dom(fields)", "avoid fetch()") is compressed enough that it takes a moment to parse.

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

Completeness3/5

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

For a destructive, open-world execution tool with no output schema, the description should state that one of code or file must be supplied and what the evaluation returns. Required parameters are listed as zero, so the mutual dependence of code/file is left entirely unstated.

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%, so all five parameters are already documented, making 3 the baseline. The description adds no meaning about tab, code, file, frame, or allow_network; its parameter mentions (fields, main_only) actually belong to the sibling tools, not this one.

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?

"Evaluate JS in page/iframe" gives a specific verb (evaluate) plus resource (JS in a page/iframe), and it explicitly contrasts itself with browser_dom and browser_text. An agent can tell this apart from the read-only extraction siblings without opening a schema.

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?

It names two concrete alternatives (browser_dom(fields), browser_text(main_only=true)) and the condition that selects them ("for extraction"), plus an explicit exclusion ("avoid fetch()"). This is direct when-to-use-other routing rather than implied guidance.

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