Skip to main content
Glama

page_eval

Evaluate a JavaScript expression in the page's main frame and return its JSON value. Use read-only expressions for safe introspection.

Instructions

Evaluate a JavaScript expression in the page's main frame and return its JSON value. Read-only introspection is safest; treat results of mutations with care.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_idYes
expressionYesJavaScript expression; the JSON-ified result is returned.
session_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
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. It meaningfully discloses that mutations are possible and should be treated with care, and it scopes evaluation to the page's main frame. It does not cover error behavior or serialization limits, but the explicit safety warning is valuable.

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 with no filler. The core action is front-loaded, and the safety guidance is placed immediately after it, making the tool easy to parse quickly.

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?

For a code-execution tool with no annotations and no output schema, the description covers the evaluation scope and return format but omits details about exceptions, serialization behavior, and the role of session_id/page_id. It is adequate but leaves meaningful gaps.

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

Parameters2/5

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

Schema description coverage is only 33%: only 'expression' has a description, while 'session_id' and 'page_id' are undocumented. The tool description adds little beyond restating the expression parameter and does not compensate for the missing parameter semantics.

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 states a specific verb ('Evaluate'), a specific resource ('JavaScript expression in the page's main frame'), and the expected output ('return its JSON value'). This clearly distinguishes page_eval from all page_* siblings, since only this tool evaluates arbitrary expressions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear usage context: read-only introspection is the recommended use, and mutations are explicitly flagged for caution. It does not name alternative tools or state explicit when-not-to-use conditions, so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.