Skip to main content
Glama

browser_eval

Execute custom JavaScript in the active browser page and return the result for data extraction, DOM checks, or automation.

Instructions

Evaluate arbitrary JavaScript in the active page context and return the result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesJavaScript code to execute in page context

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.8.0

TDQS

B3.1/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden. It discloses only that code runs in the page context and a result is returned, saying nothing about mutation risk (arbitrary JS can modify the DOM/storage), whether execution is sandboxed, how async/promise results are handled, or authorization requirements. For an arbitrary-code-execution tool this is a notable gap.

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?

A single, front-loaded sentence that states the action, the execution context, and the return behavior with zero wasted words.

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?

The description partially covers return behavior ('return the result'), which matters since no output schema exists, but for a privileged arbitrary-JS tool with no annotations it omits safety/mutation context and result-serialization details that an agent would need before invoking it.

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?

There is a single parameter with 100% schema description coverage, so the schema already documents 'script'. The description adds only the 'active page context' framing, which is baseline-level value; per the coverage rule, 3 is appropriate.

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

Purpose4/5

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

States a specific verb ('Evaluate') and resource ('arbitrary JavaScript in the active page context') plus the outcome (returns the result). This is clearly distinguishable from sibling tools like browser_click or browser_snapshot. It does not, however, name or contrast with the closest alternative, browser_cdp_send, which could also execute scripts.

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

Usage Guidelines2/5

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

No when-to-use guidance is given. The description never addresses whether to prefer this over browser_cdp_send, browser_click/browser_fill for interactions, or browser_console_logs for reading output, nor does it note prerequisites such as a loaded page.

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