Skip to main content
Glama

browser_evaluate

Evaluate JavaScript expressions in a page or cross-origin frames, bypassing permission denied errors by executing in the frame's own context.

Instructions

Evaluate a JS expression or function in the page and return the result.

    frame_ref: run the JS INSIDE a child frame instead of the top document. Accepts
    a frame id ('f1'), an element ref inside the frame ('f1e36'), or an <iframe>
    element ref ('e81'). This works for CROSS-ORIGIN frames too — the code runs in
    the frame's own context (unlike top-frame JS reaching in via contentDocument,
    which the browser blocks). This is the fix for "Permission denied to access
    property document on cross-origin object".
    Examples: 'document.title'  |  '() => window.location.href'
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYes
session_idNo
frame_refNo
Behavior2/5

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

With no annotations, the description should disclose behavioral traits like potential side effects. It only states 'evaluate' and gives read-only examples, but JavaScript execution can modify the page. The lack of warning about mutations or restrictions is a significant gap.

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?

The description is front-loaded with the core purpose, followed by detailed parameter explanation and examples. It is slightly verbose but well-structured with logical flow. No wasted sentences.

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?

Given no output schema and moderate complexity, the description covers the main functionality and frame_ref nuance, but lacks details on return value format, error handling, and session_id context. An AI agent may find it adequate but incomplete for precise invocation.

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. It thoroughly explains frame_ref with cross-origin details and gives expression examples, but completely omits session_id. Two of three parameters are well-covered, but the missing explanation hurts completeness.

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 verb 'evaluate' and the resource 'a JS expression or function in the page', accurately distinguishing it from sibling tools like browser_extract or browser_click. It specifies the action and scope without ambiguity.

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?

The description implies usage for executing JavaScript and retrieving results, but provides no explicit guidance on when to use this tool versus alternatives or when not to use it. The frame_ref detail is context-specific but does not cover broader usage scenarios.

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/Evil-Bane/eyebrowse'

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