Skip to main content
Glama

evaluate

Run JavaScript inside the current page and return the result as JSON to read computed styles, storage, app state, or perform custom checks.

Instructions

Run JavaScript inside the page and return the result as JSON text. A bare expression is returned as is (document.title); code with several statements needs an explicit return. Promises are awaited. Output is truncated after 50000 characters. Use for data the other tools cannot read (computed styles, storage, app state) and for custom checks; prefer click, type and fill_form for interaction, since they send real input events. Side effects on the page are real.

Input Schema

NameRequiredDescriptionDefault
tabNoTab id from tabs_list. Defaults to the current tab.
codeYesJavaScript: a single expression, or a function body that uses `return`, e.g. "return [...document.links].length".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.1.2
    • changedInput schema / properties / code / description
      Previous value: -"JavaScript expression or function body."New value: +"JavaScript: a single expression, or a function body that uses `return`, e.g. \"return [...document.links].length\"."
  2. First observedv0.1.1

TDQS

A4.9/5.0
Behavior5/5

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

Adds substantial context beyond the annotations: 50000-character output truncation, promise awaiting, bare-expression vs explicit-return evaluation, and an explicit warning that page side effects are real. This directly complements readOnlyHint=false and openWorldHint=true.

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?

Front-loaded with the core action and return semantics, then evaluation rules, then limits, then routing guidance. Every sentence carries distinct information with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and the description covers return form, truncation limit, and side-effect risk, which is everything an agent needs to invoke an eval-style tool safely and correctly.

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?

Schema coverage is 100%, so baseline is 3, but the description adds genuine meaning about the code parameter's evaluation model (bare expression returned as-is, multi-statement code needs return). The tab parameter is left entirely to the schema.

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?

States a specific verb and resource ('Run JavaScript inside the page') and the return form ('return the result as JSON text'). Clearly distinguishable from siblings like get_text or snapshot, which read fixed representations.

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 names the use case ('data the other tools cannot read... computed styles, storage, app state') and the exclusions, routing interaction to click, type and fill_form because those send real input events.

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