Skip to main content
Glama

javascript

Execute JavaScript within a Safari page and return the JSON-serialised result. Use it to extract page data or automate interactions by writing a function body with await supported.

Instructions

Run JavaScript in the page. Write a function body and return the value you want (await is allowed). Result is JSON-serialised.

Input Schema

NameRequiredDescriptionDefault
tabNoTab id "windowId:tabIndex" from tabs_list. Omit for the active tab of the front window.
codeYes
timeout_msNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/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 usefully discloses that code runs in the page, may use await, and that the result is JSON-serialised, but it omits side effects, permissions/security implications, timeout behavior, and error semantics for a powerful arbitrary-execution tool.

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?

Three short sentences with no filler, and the core execution contract is front-loaded.

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?

The description gives enough to write a return-producing code snippet, but for an arbitrary JavaScript execution tool with no annotations and no output schema, it should also cover timeout behavior, error handling, and side-effect expectations.

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 coverage is only 33%. The description compensates for the undocumented code parameter by explaining the function-body and return contract, and tab is covered by the schema, but timeout_ms is undocumented in both schema and description.

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 JavaScript in the page.' It is clearly distinct from the browser-interaction siblings such as click, navigate, and read_page, though it does not explicitly name alternatives.

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?

It tells the agent how to structure the code parameter ('Write a function body and return the value you want') and that await is allowed. However, it gives no explicit when-to-use guidance versus siblings or when-not-to-use conditions for arbitrary page scripting.

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