Skip to main content
Glama

browser_evaluate

Destructive

Evaluate JavaScript on a page or element to extract data or inspect content, returning results as text or a saved file. Bundle related checks in one function that returns an object.

Instructions

Evaluate JavaScript expression on page or element [PlayGuard] Each call waits ≥0.5–1.5 s for the page to settle. Combine related checks into one function that returns an object instead of calling this repeatedly.

Input Schema

NameRequiredDescriptionDefault
targetNoExact target element reference from the page snapshot, or a unique element selector
elementNoHuman-readable element description used to obtain permission to interact with the element
filenameNoFilename to save the result to. If not provided, result is returned as text.
functionYes() => { /* code */ } or (element) => { /* code */ } when element is provided

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.10.1

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, destructiveHint=true and openWorldHint=true, so the mutation risk is covered structurally. The description adds genuinely non-obvious timing behavior (≥0.5–1.5 s settle per call), which is valuable. It stops short of describing execution context (main world vs isolated), serialization of return values, or error behavior.

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?

Two sentences, zero padding, with the core action front-loaded before the PlayGuard constraint. Every sentence carries information an agent would otherwise lack.

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?

For a four-parameter tool with full schema coverage, annotations, and no output schema, the description covers what it does, the latency cost, and the batching strategy. The remaining gap is sibling disambiguation from browser_run_code_unsafe, which keeps it out of the top band.

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 four parameters (including the target vs element distinction and the filename save option) are already documented in the schema. The description adds only a light implication that code may receive 'element' and return an object; baseline 3 applies.

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 and resource: 'Evaluate JavaScript expression on page or element.' An agent can tell it is a code-execution tool rather than a navigation or snapshot tool. However, it never distinguishes itself from the near-identical sibling browser_run_code_unsafe, which is the main ambiguity an agent faces.

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

Usage Guidelines3/5

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

The PlayGuard note gives real usage guidance — combine related checks into one function instead of calling repeatedly — but only for batching within this tool. There is no statement of when to prefer this over browser_run_code_unsafe, browser_snapshot, or browser_console_messages, so the sibling routing is left implicit.

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