Skip to main content
Glama
surpasses
by surpasses

evaluate

Run a JavaScript expression in the page and return its result, with optional frame targeting for iframes.

Instructions

Evaluate a JavaScript expression in the page (top frame by default) and return its value. Use frame (e.g. f1) to target an iframe. Never trigger alert/confirm/prompt.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
frameNo
tabIdYesTab id from tabs_context
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the behavioral disclosure burden. It discloses top-frame default and warns against alert/confirm/prompt, which is useful. However, it does not mention that evaluating JS can mutate page state, trigger navigation, or that return values may need to be serializable.

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 concise, front-loaded sentences. The main purpose is stated first, followed by frame targeting and a critical behavioral warning. Every sentence earns its place with no wasted words.

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

Completeness2/5

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

For a powerful evaluate tool with no annotations and no output schema, this is incomplete. It omits important guidance on expression syntax, promise/async handling, result serialization, and side-effect risk. An agent could invoke it incorrectly or misinterpret the returned value.

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 only 33%, so the description must compensate. It clarifies `frame` with an example format (e.g. f1) and explains that `expression` is evaluated and returned. But it doesn't give concrete expression examples or return-value expectations, and `tabId` is only described in 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?

Description clearly states the verb ('Evaluate') and resource ('JavaScript expression in the page'), plus the return value behavior. It also distinguishes frame targeting from the top-frame default, differentiating it from sibling navigation/read tools.

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?

The description gives some context on how to target an iframe with `frame`, but it does not explicitly state when to choose evaluate over siblings like read_page or get_page_text, nor when not to use it. The warning about dialogs is a constraint, not a usage guideline.

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