Skip to main content
Glama

browser_evaluate

Destructive

Run custom JavaScript on the page or a selected element to inspect or manipulate the DOM, extract data, or verify behavior. Results can be saved to a file or returned as text.

Instructions

Evaluate JavaScript expression on page or element

Input Schema

TableJSON 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
filenameNoFile name to save the result to. Relative file names are resolved against the workspace root. 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.1.0

TDQS

C2.8/5.0
Behavior2/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, indicating this is a mutating, potentially harmful operation. The description adds no additional behavioral context—no mention of side effects, permission requirements, or what exactly could be destroyed. It essentially restates the tool's name without enriching the safety profile beyond what the annotations already provide.

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

Conciseness3/5

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

The description is extremely concise—a single sentence. While this is efficient, it lacks any structural breakdown or additional context. It is not front-loaded with critical details like safety warnings or usage hints. It is concise but under-specified, missing the balance between brevity and informativeness.

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

Completeness2/5

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

Given the tool's complexity (executes arbitrary JavaScript) and destructive nature, the description is notably incomplete. It does not explain return value format, error handling, or what happens when the function mutates the page. There is no output schema, so the description must cover these aspects, but it fails to do so. The presence of a sibling like browser_run_code_unsafe further highlights the need for differentiation, which is absent.

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 every parameter (target, element, filename, function) is documented in the schema. The description adds no extra semantic information about the parameters, such as how the function signature works or how target interacts with element. Since the schema fully covers parameter meanings, a baseline score of 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?

The description clearly states the action ('Evaluate JavaScript expression') and the target ('on page or element'). It is specific enough to convey the core function. However, it does not differentiate from the sibling tool browser_run_code_unsafe, which also executes JavaScript, so the agent might struggle to choose between them based solely on the description.

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?

The description gives no guidance on when to use this tool versus alternatives. It does not mention browser_run_code_unsafe or any other relevant sibling, nor does it state any prerequisites, limitations, or conditions that would steer the agent toward or away from this tool. This leaves the agent without clear decision support.

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