Skip to main content
Glama

page_eval

Run JavaScript inside the current dedicated browser page and return a JSON-serializable value, with a ten-second timeout and results truncated to 2000 characters.

Instructions

在当前页面里执行一段 JS(可 return 一个能转成 JSON 的值),只在专用浏览器的页面里,碰不到电脑上的文件。十秒超时,结果截到 2000 字。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "script": "<script>"
    },
    "name": "page_eval"
  }
}

Input Schema

NameRequiredDescriptionDefault
scriptYes

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, the description carries the full burden, and it discloses meaningful behavior: a ten-second timeout, results truncated to 2000 characters, and the return value must be JSON-serializable. It also declares sandboxing to the browser page with no filesystem access. It omits whether the script may mutate page state (it is effectively a write-capable tool) and what happens on timeout or exceptions, which keeps it below a 5.

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?

A single compact sentence with a parenthetical aside; every clause carries information (execution scope, return convention, sandbox boundary, timeout, truncation) and the sandbox constraint is front-loaded. No padding or repetition.

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?

For a one-parameter tool with no output schema and no annotations, the description covers the essentials: what it does, where it runs, what it returns, and its limits. It stops short of describing failure modes (timeout errors, syntax errors) or page-state side effects, which an agent would want before running arbitrary JS.

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 coverage is 0% for the single 'script' parameter, so the description must compensate, and it only partially does: it explains the return convention (a JSON-convertible value) but not the script form — whether it is a function body, whether async/await or arguments are supported, or how results are serialized beyond truncation.

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 names a specific verb and scope: executing a JS snippet in the current page ('在当前页面里执行一段 JS') and returning a JSON-convertible value. This is inherently distinguishable from sibling page tools like page_click, page_read, or page_type, which are curated DOM interactions rather than arbitrary script execution.

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

Usage Guidelines3/5

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

It gives a hard constraint — it only runs inside the dedicated browser's page and cannot reach files on the computer — which implicitly tells the agent not to use it for filesystem work. However, it never states when to prefer this over sibling page_read/page_click for reading or manipulating page content, nor any preconditions such as needing page_open first. Usage is inferable but not spelled out.

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