Skip to main content
Glama

browser_eval

Execute JavaScript code in the active page to inspect or modify its state, returning results as JSON-serializable values. Useful for dynamic testing and debugging.

Instructions

Evaluate a JavaScript expression in the active page (via CDP) and return its value. Runs in the page's main world and can mutate page state. Prefer browser_snapshot for reading structure and browser_click/type for interactions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYesA JavaScript expression evaluated in the page; its result is returned (JSON-serializable values).
Behavior5/5

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

The description adds significant context beyond the annotations (openWorldHint=true, destructiveHint=false). It details that evaluation runs in the page's main world and can mutate page state, which helps the agent understand the tool's impact on the environment.

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 two sentences: the first clearly states the action, the second provides guidance on alternatives. Every sentence is essential and front-loaded, with no wasted words.

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?

The description is quite complete for a simple tool: it covers core behavior, mutation potential, and usage alternatives. Minor omissions like error handling or async nature are acceptable given the straightforward nature, but it could be slightly more thorough.

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

Parameters5/5

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

With 100% schema coverage, the schema already describes the 'expression' parameter. However, the description adds value by clarifying that the expression is evaluated in the active page via CDP and mentioning the return type, which aids correct usage.

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 explicitly states 'Evaluate a JavaScript expression in the active page (via CDP) and return its value,' which is a specific verb-resource pair. It also distinguishes itself from siblings by advising alternatives for reading and interaction (browser_snapshot, browser_click/type).

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 provides clear usage guidelines: it recommends browser_snapshot for reading structure and browser_click/type for interactions, implying when not to use this tool. It also mentions it can mutate page state, cautioning about unintended side effects.

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/vincentvella/devloop'

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