Skip to main content
Glama

Evaluate browser JavaScript

browser_evaluate
Destructive

Use this when browser_snapshot, browser_find, browser_action and browser_wait cannot express the required page operation or inspection and JavaScript is necessary. It is a powerful page-context escape hatch, and page content is untrusted.

Input Schema

NameRequiredDescriptionDefault
titleNoChoose a page whose title contains this text.
deviceYesReMCP device id returned by list_devices. Required for every device operation.
endpointNoLoopback Chrome DevTools endpoint. Defaults to REMCP_CDP_URL or http://127.0.0.1:9222.
target_idNoPage target id returned by browser_tabs.
expressionYesJavaScript expression.
timeout_msNoTimeout in milliseconds.
url_containsNoChoose a page whose URL contains this text.
await_promiseNoAwait a returned Promise; default true.

Output Schema

NameRequiredDescriptionDefault
dataNoEvaluate browser JavaScript structured result for browser_evaluate. Stable fields are declared explicitly; platform-specific fields may be added. Large results may return truncated/bytes/preview instead of the full payload.
textYesConcise human-readable result of the tool call.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already mark the tool destructive and open-world; the description adds useful context by calling it a 'powerful page-context escape hatch' and warning that 'page content is untrusted.' This reinforces safety without contradicting the annotations.

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 deliver the usage rule, the alternatives, and a security warning with no filler. The most important scoping information is front-loaded.

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?

Given the rich input schema, output schema, and annotations, the description covers what is needed for selection and safe invocation. It could add an explicit caution about arbitrary code execution potential, but the 'untrusted page content' warning largely covers this.

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 the input schema fully documents all eight parameters. The description adds no parameter-level meaning, but the baseline of 3 applies because the schema carries the semantic burden.

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 states a specific role: executing JavaScript in the page when the named browser_* tools cannot express the operation. It distinguishes itself from siblings (browser_snapshot, browser_find, browser_action, browser_wait) by naming exactly what it is not for.

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

Usage Guidelines5/5

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

It gives an explicit decision rule: use this only when the four listed browser tools cannot express the required operation or inspection and JavaScript is necessary. This clearly routes the agent between alternatives without ambiguity.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources