Skip to main content
Glama

js

Execute a JavaScript expression in an iOS Safari page and return its JSON value—use it to read or assert page state without screenshots or typing.

Instructions

Run a JavaScript expression in the page and return its value as JSON. Milliseconds, no screenshot or typing.

Input Schema

NameRequiredDescriptionDefault
pageNoindex in inspector_pages; default the first page with a real address
waitNoseconds to wait for the page list, default 60
expressionYes
await_promiseNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden. It discloses that the expression runs in the page and returns JSON, but does not state whether arbitrary JS can mutate or break the page, whether promises are awaited by default, or what permissions or side effects apply.

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?

The description is short and front-loads the core action. The second sentence is terse and somewhat cryptic, but it avoids waste.

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?

This is a powerful arbitrary-JS-execution tool with no annotations, no output schema, and four parameters. The description is too sparse to cover key risks and behaviors such as mutation side effects, promise handling, page targeting, and wait semantics.

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?

The description explains 'expression' as a JavaScript expression and loosely references the page context. However, with only 50% schema description coverage, it does not clarify the 'wait' or 'await_promise' parameters, and 'await_promise' has no schema description at all.

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 states a specific verb and resource: run a JavaScript expression in the page and return its value as JSON. It partially distinguishes itself from sibling tools by noting 'no screenshot or typing,' but it does not clarify its relationship to tools like dom or inspector_raw.

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 phrase 'no screenshot or typing' hints that this tool is not for visual capture or text entry, implying its use for direct JS evaluation. However, it names no alternatives and gives no explicit when-to-use or when-not-to-use guidance against the many sibling browser tools.

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