Skip to main content
Glama

evaluate

Run a JavaScript expression in the current page and return its JSON value, including awaited promises, to extract data that other tools cannot read.

Instructions

Run a JavaScript expression in the current page and return its value as JSON (a promise is awaited). For data the other tools do not read.

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": {
      "expression": "<expression>"
    },
    "name": "evaluate"
  }
}

Input Schema

NameRequiredDescriptionDefault
expressionYesJavaScript expression, e.g. `document.title` or `[...document.querySelectorAll('h2')].map(e => e.textContent)`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.1.47-alpha
    • addedInput schema / properties / expression / description
      Added value: +"JavaScript expression, e.g. `document.title` or `[...document.querySelectorAll('h2')].map(e => e.textContent)`."
  2. First observedv0.1.46

TDQS

A4/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full burden. It does disclose meaningful behavior — the expression runs against the current page and promise results are awaited before serialization. However, it never warns that arbitrary JS executes with page privileges and can mutate DOM or trigger side effects, nor does it mention failure/error behavior for throwing expressions.

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?

Two short sentences, no filler, with the core action front-loaded and the scoping rule appended where it is most useful. The parenthetical about promises is compact and load-bearing.

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?

With one 100%-documented parameter and no output schema, the essentials are covered: what runs, where, and what comes back. The remaining gap is the absence of side-effect/permission caveats, which matter for an arbitrary-code-execution tool with no annotation safety signals.

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% and the schema already gives two concrete examples, so the parameter is well specified without the description's help. The description adds only the execution context ('current page') and return serialization, neither of which is about the expression argument itself.

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 resource ('Run a JavaScript expression in the current page') and states the return contract ('value as JSON, promise awaited'). The closing clause 'For data the other tools do not read' distinguishes it from the read_* / snapshot / links siblings without requiring the agent to compare schemas.

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?

'For data the other tools do not read' establishes a clear selection rule — this is the fallback when the structured readers fall short. It stops short of naming the specific alternatives it supersedes or stating when not to use it (e.g. prefer read_text for plain text).

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