Skip to main content
Glama
ricardochen1996

browser-use-mcp

Evaluate JavaScript

browser_eval
Destructive

Evaluates a JavaScript expression in the page and returns its result as a string or capped JSON, enabling programmatic reads and one-off DOM operations beyond indexed actions.

Instructions

Evaluate one JavaScript expression in the page this session owns and return what it produced: a string as itself, any other value as JSON, capped so one dump cannot crowd out the conversation. Use it for a programmatic read the indexed action space cannot express, or a one-off DOM operation. It runs on this session's one CDP connection: never start a second client — a raw websocket, a puppeteer/playwright script, another browser-harness daemon — because Chrome 144+ asks "Allow remote debugging?" once per connection and two drivers race each other on the same page. The expression gets no user gesture, a thrown error comes back as text, and it produces no observation: call browser_page before the next browser_act.

Input Schema

NameRequiredDescriptionDefault
expressionYesThe JavaScript expression to evaluate in the page.
timeout_msNoHow long an awaited promise may take, in milliseconds. Default 30000, at most 120000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

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

Adds substantial context beyond the annotations: output is capped, a thrown error returns as text, there is no user gesture, the call produces no observation, and browser_page must be called before the next browser_act. The single-CDP-connection constraint and the Chrome 144+ permission race are exactly the kind of operational hazard annotations cannot express.

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?

The purpose and return shape are front-loaded in the first sentence, and the operational warnings follow. Sentences are dense and long, but each carries distinct information; a slightly tighter phrasing of the second-driver warning would help.

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

Completeness5/5

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

With no output schema, the description carries the return contract itself (string as-is, other values as JSON, capped) and explains state sequencing after the call. For a tool annotated destructive and open-world, the side-effect and session constraints are fully covered.

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 both expression and timeout_ms are already documented, and the description does not restate or extend timeout semantics. It adds related context (no user gesture, error-as-text) but nothing about parameter formats beyond the schema, so baseline 3 applies.

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?

States a specific verb (evaluate) plus resource (one JavaScript expression in the page this session owns) and defines the return contract. It is clearly distinguishable from browser_act ('the indexed action space') and browser_page, so an agent can pick it without opening the schema.

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?

Gives concrete selection criteria: use for a programmatic read the indexed action space cannot express, or a one-off DOM operation. It also warns against starting a second CDP client. It stops short of explicit 'do not use this for X, use browser_act instead' routing, but the context is clear.

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