Skip to main content
Glama

browser_evaluate

Executes a JavaScript expression in the shared page and returns its JSON value; requires enabling haiBrowser.allowEvaluate.

Instructions

Run a JavaScript expression in the shared page and return its JSON value. Disabled unless the user enables haiBrowser.allowEvaluate.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full burden and does disclose the gating configuration (haiBrowser.allowEvaluate) and the JSON return contract, which is useful. It omits major behavioral traits: arbitrary JS can mutate page state, there is no statement about timeouts, waiting for the page to settle, or error propagation on a throwing expression.

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 short sentences, no filler, with the core action front-loaded and the precondition second. Every clause earns its place.

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?

For a code-execution tool with no annotations and no output schema, the description covers the action and the enablement gate but leaves the agent guessing about side effects, timeouts, and error behavior. Adequate but with clear gaps given the risk profile of arbitrary evaluation.

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 coverage is 0% and the single required 'expression' parameter is undocumented in the schema. The description adds only that the expression is JavaScript and that its value is returned as JSON — mildly useful, but it does not clarify evaluation scope, serialization limits, or whether async/promise expressions are awaited.

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 ('Run') and resource ('JavaScript expression in the shared page') plus the return shape (its JSON value). It is clearly distinguishable from read-only siblings like browser_console or browser_snapshot, though it never names an alternative explicitly.

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?

Provides a real precondition — the tool is disabled unless the user enables haiBrowser.allowEvaluate — which tells the agent when the call will fail. It gives no guidance on when to prefer this over sibling tools such as browser_console or browser_snapshot for inspecting page state.

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