Skip to main content
Glama

evaluate

Run JavaScript in the active Edge tab's page context and return a JSON-serializable result; supports await and DOM globals for inspecting or extracting page data.

Instructions

Run a JavaScript expression in the active tab's page context and return the result as JSON. The expression is evaluated as the body of an async function, so you can use await. DOM globals (document, window) are available. Results must be JSON-serializable.

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 to evaluate, e.g. document.title or (() => document.querySelectorAll('a').length)()

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations supplied, the description carries the full burden and does disclose the key mechanical traits: the expression is the body of an async function, await is usable, document/window are in scope, and results must be JSON-serializable. It omits the safety-relevant fact that arbitrary page-context code can mutate the DOM, navigate, or trigger side effects, and says nothing about error behavior, execution limits, or how non-serializable or undefined results surface.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four short sentences, front-loaded with the action and context, then the two constraints that affect how the expression is written. No filler; the only mild inefficiency is that the JSON-serializability note and the async-wrapper note are in separate sentences that could be trimmed into one.

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 one-parameter tool with no output schema, the description covers the mechanics of the input well enough to call it correctly. It is incomplete on the return shape (whether the result is wrapped, what happens for undefined or circular values) and on failure modes, so an agent cannot predict outcomes of a malformed or throwing expression.

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% and the schema already supplies an example expression, so the baseline is 3. The description earns above baseline by stating that the string is evaluated as an async function body with DOM globals available, which materially changes how the agent should author the value (awaits allowed, no wrapper needed) in a way the schema does not convey.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Run a JavaScript expression in the active tab's page context and return the result as JSON" gives a specific verb and resource, and pins the execution context (active tab, page context) rather than an isolated sandbox. It does not contrast itself with reading siblings like get_text or get_html, which also retrieve page content, so an agent must infer that this is the arbitrary-code escape hatch.

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

Usage Guidelines2/5

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

There is no explicit when-to-use or when-not-to-use guidance and no named alternative among the 16 siblings. The agent gets no signal about preferring get_text/get_html for simple extraction, or about when click/fill should be used instead of scripting a click via evaluate.

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