Skip to main content
Glama

browser_eval

Execute JavaScript in the current page to inspect the DOM, read texts, count elements, or try selectors, and get the result.

Instructions

Executes arbitrary JavaScript in the current page and returns the value (useful to inspect the DOM, read texts, count elements, try selectors).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYesJS expression (evaluated with the returned result)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/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 burden of behavioral disclosure, but it only states that arbitrary JS is executed and a value is returned. It does not warn that arbitrary code can mutate the page, navigate, trigger network requests, or leave persistent state, which is a significant transparency gap for an eval tool.

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 a single, well-structured sentence with the core behavior front-loaded and useful use cases in parentheses. There is no filler or redundant content.

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 tool is simple in shape (one required string, no output schema), but arbitrary JS execution has open-ended side effects and evaluation semantics. The description covers why to use it and what it returns, yet omits prerequisites like an open page and behavior around asynchronous or non-serializable results, so it is only partially complete.

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?

The only parameter is already fully described by the input schema ('JS expression (evaluated with the returned result)'), so the baseline is 3. The top-level description adds 'arbitrary JavaScript' and 'returns the value' but provides little additional semantic detail beyond what the schema already states.

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 names a specific verb ('executes') and resource ('arbitrary JavaScript in the current page') and states that it returns the value. The concrete use cases ('inspect the DOM, read texts, count elements, try selectors') clearly distinguish it from the click/scroll/navigation sibling tools.

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 provides clear, concrete use cases that tell an agent when to choose this tool, such as inspecting the DOM or trying selectors. It does not explicitly mention alternatives or when not to use it, so it falls just short of a 5.

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