Skip to main content
Glama
nbiish

Better Browser MCP

by nbiish

browser_evaluate

Execute arbitrary JavaScript in the live page to retrieve JSON-serializable data that ARIA snapshots cannot access, such as component state or computed styles.

Instructions

Run an arbitrary JavaScript expression in the page's main frame context. Returns the JSON-serializable result. Escape hatch for when ARIA snapshots cannot introspect something — React/Vue component state, computed styles, custom data attributes, third-party widget internals, hidden DOM the snapshot can't reach. The result must be JSON-serializable and is capped at 10KB. The expression runs in the page's global scope via indirect eval (sees window, document, etc.) and any side effects DO persist — only call this with code you have reviewed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tabIdNoOptional tab ID to target. When omitted, routes to the agent's active tab. Use browser_list_tabs to see available tab IDs.
expressionYesJavaScript expression to evaluate. The last expression value is returned. Example: `document.querySelector('h1').textContent` or `Array.from(document.querySelectorAll('a')).map(a => a.href)`.
Behavior5/5

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

With no annotations, the description carries full burden. It discloses indirect eval, global scope access (window/document), persistent side effects, JSON-serializability requirement, and the 10KB result cap. This is rich behavioral context beyond what any structured field would provide.

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 three dense, front-loaded sentences. The first sentence states the core function, the second explains when to use it, and the third covers technical constraints and safety. Every sentence earns its place without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a powerful and potentially dangerous tool, the description covers purpose, use case, execution model, constraints, and safety. It lacks explicit error-handling details, but given no output schema and no annotations, it provides sufficient context for the agent to select and invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for both parameters, providing a solid baseline (3). The description adds further meaning by detailing the execution environment (indirect eval, global scope, side effects persist) and result constraints, enriching the semantics of the 'expression' parameter.

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 clearly states the tool runs arbitrary JavaScript in the page's main frame context and returns a JSON-serializable result. It also positions itself as an escape hatch for ARIA snapshot limitations, effectively distinguishing it from sibling browser tools.

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?

The description explicitly tells when to use the tool: when ARIA snapshots cannot introspect React/Vue state, computed styles, custom data attributes, third-party widget internals, or hidden DOM. It also warns about persistent side effects, implying safer alternatives for ordinary interactions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nbiish/betterbrowsermcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server