Skip to main content
Glama

browse_eval_js

Evaluates a JavaScript expression in the current page and returns its JSON value, enabling extraction or verification of page data during browser automation.

Instructions

Evaluate a JavaScript expression in the page and return its JSON value.

Input Schema

NameRequiredDescriptionDefault
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.2

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden. It does state that results come back as a JSON value, but it omits the critical traits of an arbitrary-code-execution tool: that the expression runs in page context, whether promises/async are awaited, how errors are surfaced, and whether side effects on the page are possible.

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?

One sentence, front-loaded with the action and ending with the return contract; nothing is wasted. Its brevity is efficient rather than padded, though it borders on under-specification for a code-execution tool.

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 one-parameter tool with no output schema, the description covers input kind and return format at a minimum viable level. However, given an unannotated arbitrary-JS-execution tool, the absence of error behavior, async handling, and page-context caveats leaves meaningful gaps.

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%, so the description must compensate for the single undocumented parameter. It does add real meaning by calling the argument an 'expression' (not a statement or function body), implying expression-style evaluation, but gives no syntax hints such as awaiting promises or serializability constraints on the returned value.

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 ('Evaluate') and resource ('a JavaScript expression in the page') plus the return shape ('its JSON value'), so an agent knows exactly what the tool does. It doesn't name a contrasting sibling (e.g., browse_get_text or browse_snapshot) that would clarify when this is preferred over those extraction tools.

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?

There is no guidance on when to use this instead of browse_get_text, browse_snapshot, or browse_wait_for, and no exclusions or preconditions (page loaded, context available). The agent must infer applicability from the name alone.

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