Skip to main content
Glama

evaluate

Run custom JavaScript in the page to retrieve JSON results for measurements, UI state changes, or framework data when no standard tool applies.

Instructions

ESCAPE HATCH — run arbitrary agent-authored JavaScript in the page and get the JSON result. Use ONLY when no purpose-built tool covers the need: a custom measurement, forcing a UI state (dispatch an event / toggle a class), or reading framework/component state. Prefer explain_styles / measure_element / inspect_element / interact where they apply — reach for evaluate when the question is genuinely bespoke and none of them fits. The JS is trusted (you wrote it); its result is returned verbatim and size-capped.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeoutMsNoMax run time in ms before aborting (default 5000, clamped 100..30000).
expressionYesJavaScript evaluated in the page (top-level frame). May be an expression (e.g. "getComputedStyle(document.body).zoom"), a bare object literal (e.g. "{ w: innerWidth, h: innerHeight }"), or an IIFE for multi-step logic. The value it produces is returned as JSON.
awaitPromiseNoIf the expression yields a Promise, await it and return the resolved value (default true).
Behavior4/5

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

With no annotations, the description carries full burden. It mentions the JS is trusted (authored by agent), result is returned verbatim and size-capped. However, it does not explicitly caution about potential side effects on page state, which is a notable omission for an arbitrary execution 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?

The description is highly concise (3 sentences) and front-loaded with the label 'ESCAPE HATCH' to immediately convey its nature. Every sentence adds value: purpose, usage restrictions, and behavioral notes. 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?

Given the tool's complexity (arbitrary JS execution) and absence of output schema, the description adequately states that the result is JSON and size-capped. It does not mention error handling (e.g., JS exceptions), which is a minor gap, but overall sufficiently 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 baseline is 3. The description does not add parameter-specific information beyond what the schema already provides for timeoutMs, expression, and awaitPromise. The context given is general and does not enhance parameter understanding.

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 function: 'run arbitrary agent-authored JavaScript in the page and get the JSON result.' It distinguishes the tool from siblings by explicitly naming alternative tools (explain_styles, measure_element, etc.) and their applicability.

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 states 'Use ONLY when no purpose-built tool covers the need' and provides concrete examples (custom measurement, forcing UI state, reading framework state). It also directs to prefer specific sibling tools, giving clear when-to-use and when-not-to guidance.

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/mi60dev/visionaire-engine'

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