Skip to main content
Glama

Browser Evaluate

browser_evaluate

Execute JavaScript expressions in an active browser page and retrieve evaluated results, enabling direct DOM inspection, network requests, and script execution for advanced automation.

Instructions

Evaluate JavaScript in the page and return the result.

Prefer a function expression: "() => document.title" or "(x) => fetch(x).then(r => r.status)" with arg passed as parameter. Everything the page can do is allowed — this is raw power, use responsibly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argNo
tabNo
sessionNodefault
expressionYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

A4.1/5.0
Behavior4/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 discloses that arbitrary page-level JavaScript is allowed, that results are returned, and that promise-returning expressions work (via the fetch example). The 'raw power, use responsibly' warning conveys potential side effects, though it does not enumerate specific risks such as navigation, mutation, or data leakage.

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?

The description is short, front-loaded with the core purpose, and every sentence contributes. The function-expression guidance and the 'raw power' warning are compact but high-value, making the text efficient and readable.

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?

The description covers the main invocation pattern, result return, and the breadth of allowed execution, and an output schema exists for return values. However, it does not explain tab/session disambiguation, serialization behavior, error handling, or the execution context of the expression, leaving some gaps for a raw JavaScript evaluation tool.

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 0%, so the description must add meaning. It clearly explains the 'expression' parameter and demonstrates how 'arg' is passed into the function. However, it does not clarify the 'tab' or 'session' parameters, leaving their role entirely to the agent to infer.

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 uses a specific verb and resource: 'Evaluate JavaScript in the page and return the result.' This clearly distinguishes the tool from sibling tools that snapshot, extract, click, fill, or navigate, because those are page actions rather than arbitrary JavaScript evaluation.

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?

The instruction to prefer a function expression and to pass arguments via the 'arg' parameter gives concrete guidance on how to invoke the tool. It also implies the tool is for any page capability not covered by dedicated browser tools, though it does not explicitly name alternatives or exclusion cases.

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