Skip to main content
Glama
ohaoz
by ohaoz

eval_js

Evaluate JavaScript in the live browser page via Playwright to extract dynamic DOM data and return JSON results. Use expressions or async functions for read-only page inspection.

Instructions

Evaluate JavaScript in the page via Playwright and return the result (JSON-projected; depth<=8, strings<=200k chars). Pass an expression or () => ... function source as code; top-level await is allowed. The sandbox is READ-ONLY and stripped: DOM reads, getComputedStyle, and scrolling work, but there is NO fetch/XMLHttpRequest/network, NO DOM mutation, no setInterval, and window only exposes an allowlist - use fetch_url or goto for network data. Warns if the tab is on a chrome-error:// page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesExpression or function source to evaluate in the page.
tab_idNoOptional tab id.
Behavior4/5

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

With no annotations provided, the description carries the full burden and does substantial work: it discloses the READ-ONLY sandbox, the fetch/DOM-mutation/setInterval restrictions, the window allowlist, JSON projection depth/size limits, top-level await support, and the chrome-error:// page warning. This is rich behavioral disclosure for a tool with zero annotations, missing only explicit reversibility/permission details.

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 information-dense and front-loaded with the core purpose, then progresses to constraints and usage guidance. It's longer than minimal but every sentence adds unique value (limitations, alternatives, warnings), with no filler or redundancy.

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 absence of annotations and output schema, the description compensates well: it covers the return projection limits, sandbox constraints, network-data alternative, and edge-case warning. It doesn't describe exact return value shape or error behavior, but the tool's expressed behavior is adequately specified for a 2-param evaluator with no output schema.

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?

The schema has 100% coverage, so baseline is 3. The description adds meaningful value beyond the schema: it elaborates on the 'code' parameter by explaining it can be an expression OR `() => ...` function source, and that top-level await is supported. It also clarifies invocation semantics beyond mere parameter names.

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+resource: 'Evaluate JavaScript in the page via Playwright and return the result'. It distinguishes from siblings by specifying JSON-projection limits (depth<=8, strings<=200k chars) and the READ-ONLY stripped sandbox, which differentiates it from browser_exec and related automation 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 specifies when to use this tool (DOM reads, getComputedStyle, scrolling) and when NOT to (no fetch/network, no DOM mutation), explicitly directing users to 'use fetch_url or goto for network data'. This gives clear alternatives among siblings.

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/ohaoz/chrome-use-mcp'

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