Skip to main content
Glama

evaluate_js

Read-only

Evaluate a JavaScript expression in the current or specified page and return its JSON-serializable result as JSON text.

Instructions

Evaluate a JavaScript expression in the page and return its (JSON-serializable) result, as JSON text inside the untrusted-content fence.

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_js"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlNo
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

C2.9/5.0
Behavior3/5

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

The annotations already establish readOnlyHint=true and openWorldHint=true, so the safety baseline is covered. The description adds genuinely useful context by disclosing that the result is JSON-serializable and delivered as JSON text wrapped in an untrusted-content fence. It says nothing about timeouts, error behavior, or whether arbitrary script can produce side effects on page state, which is a meaningful omission for code execution.

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?

A single front-loaded sentence with no filler; the return contract follows immediately after the action. Appropriately sized, though it is arguably too short given the undocumented 'url' parameter.

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 code-execution tool with no output schema and zero parameter documentation, the description should describe error/timeout behavior and the role of 'url'. Neither is present, leaving real gaps an agent cannot resolve from structured fields.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and the schema exposes only bare 'Url' and 'Expression' titles. The description explains nothing about the 'url' parameter — whether it navigates first, restricts execution to a frame, or is optional context — so an agent must guess. Only the 'expression' parameter's meaning is conveyed indirectly.

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?

The description names a specific verb and resource ('Evaluate a JavaScript expression in the page') and states what is returned, which distinguishes it from read-only siblings like get_page_html or read_page. It stops short of explicitly naming when to prefer those siblings, but the action is unambiguous.

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 when-to-use or when-not-to-use guidance, and no alternatives are mentioned despite siblings such as page_elements, get_page_html, and read_page that overlap in purpose. The phrase 'in the page' only hints that a page must already be loaded.

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