Skip to main content
Glama

Run JS

browser_eval

Evaluates a JavaScript expression in a browser tab and returns the result as JSON. Use as an escape hatch when standard tools cannot read or modify the page DOM.

Instructions

Evaluates a JavaScript expression in the tab and returns the result as JSON. Escape hatch only when other tools can't do it. Runs in an isolated world: DOM can be read and modified, but globals created by page scripts (window.appVar, etc.) are not visible.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tabNoTarget tab: number (1, 2…) or ID ("t7"). Use the stable ID when agents share a slot. Required for action tools when there are multiple tabs.
slotYesBrowser slot 1-30. "3", "slot 3", "browser 3" → 3. If the user gives a port like 14052, subtract 14049.
agentNoYour display name, shown to other agents. Subagents must always set it. Default "claude-68d9".
summaryNoOne-line note of what you are doing (e.g. "comparing laptop prices"). Shown in browser_status (not the status line). Omit to keep the previous one.
multiSlotNotrue only when one agent must handle several slots together (e.g. comparing). Normally omit (one agent = one slot; use subagents for the rest)
expressionYesJS expression (Promises are awaited)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/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 burden and does substantial work: it discloses the isolated-world execution model, that DOM can be read and modified, and that page-created globals (window.appVar) are invisible. It leaves out failure modes (CSP blocks, thrown errors) and persistence of DOM mutations, so it falls short of a 5.

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?

Three tight sentences, front-loaded with purpose, then usage constraint, then the critical execution-environment caveat. No filler.

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?

For a tool with no annotations and no output schema, the description covers purpose, fallback usage, return format, and the isolated-world semantics that would otherwise surprise an agent. It could say more about error behavior and whether mutations persist, but it is largely complete.

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 every parameter (tab, slot, agent, summary, multiSlot, expression) is already documented in the schema. The description adds no parameter-level syntax or format detail, so the 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 (evaluates) and resource (a JavaScript expression in the tab) plus the return form (result as JSON). It clearly differentiates itself from the DOM-oriented siblings by positioning itself as the escape hatch rather than a structured action tool.

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?

"Escape hatch only when other tools can't do it" is an explicit when-to-use and when-not-to-use rule. Combined with the sibling list of purpose-built browser_* tools, an agent knows to reach for this only as a fallback.

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