Skip to main content
Glama

evaluate_javascript

Execute JavaScript in the active Safari page on a real iPhone and receive the result as a string, enabling custom DOM queries, data extraction, and page interaction during automated testing.

Instructions

Run JavaScript in the page and return the result as a string.

Wrap in return ... to get a value back, e.g. return document.title;

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

With no annotations provided, the description carries the full burden of disclosing behavior. It usefully reveals that the result is converted to a string and that `return` is required to capture a value, but it omits potential side effects of executing arbitrary code, error handling behavior, or implications for the page state. This is a notable gap given the tool allows arbitrary script execution.

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?

The description is extremely concise, consisting of two short sentences. The first sentence states the tool's purpose, and the second provides a necessary usage tip. There is no wasted wording or redundant information, making it highly efficient.

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

Completeness4/5

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

Given that this is a simple tool with one parameter and an output schema, the description adequately covers the core functionality. It explains what the tool does, how to use the parameter, and the return type. Minor missing details include side effects and error handling, but the description is sufficient for a basic understanding and correct invocation.

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?

The schema provides only the parameter name 'code' with no description, so the description must add meaning. It does so effectively by explaining how to use the `code` parameter: wrap the desired expression in `return ...` to get a value back, with a concrete example. This goes beyond the schema, though it could further clarify error cases or that the code executes in the page context.

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?

The description clearly states the tool's function: 'Run JavaScript in the page and return the result as a string.' This uses a specific verb ('Run') with a clear resource ('JavaScript in the page') and outcome ('return the result as a string'). It distinguishes this tool from siblings like click, type_text, and screenshot, which perform entirely different actions.

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

Usage Guidelines4/5

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

The description provides clear context for use, stating that the tool evaluates JavaScript and returns a string. It also gives an explicit usage pattern ('Wrap in `return ...` to get a value back, e.g. `return document.title;`'), which guides the user on how to invoke it correctly. However, it does not explicitly state when not to use it or name alternative tools, though the sibling list makes the tool's unique role fairly obvious.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ikatkov/iphone-safari-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server