Skip to main content
Glama

eval

Execute JavaScript code in the browser's DOM context to extract or manipulate page data, returning the result as a JSON string.

Instructions

Run arbitrary JavaScript in the embedded QuickJS runtime against the current page's parsed DOM. Returns the JSON-stringified result. Power tool — prefer query/text/blockmap when the CSS selector engine can express what you need. Canonical param is code; raw JSON-RPC also accepts script or expression aliases and errors if no code-like param is present.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesJS code; the value of the last expression is returned
Behavior4/5

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

Describes execution context (embedded QuickJS, parsed DOM), return format (JSON-stringified), and error condition (no code-like param). Lacks mention of sandboxing or side effects, but adequate given nature of tool.

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 sentences, no filler. Front-loaded with primary purpose, then guidance and param details. Every sentence earns its place.

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?

Complete given lack of output schema: states return format and context. No gaps for a power tool of this complexity.

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?

Schema covers param fully (100% coverage). Description adds value: explains aliases (script, expression) and explicit error behavior if no code-like param is provided.

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?

Clear verb 'run arbitrary JavaScript' with specific target 'current page's parsed DOM'. Distinguishes from sibling tools like query/text/blockmap by explicitly stating preference for those when possible.

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?

Explicitly advises to prefer query/text/blockmap when CSS selector engine suffices, and documents canonical param vs. alternative aliases with error behavior.

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/protostatis/unbrowser'

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