Skip to main content
Glama

js

Execute async JavaScript in a persistent REPL to automate macOS apps, manage multi-window layouts, and control browser tabs.

Instructions

Codex-identical persistent JavaScript REPL (cua_repl). Top-level bindings persist across calls. Exposes cua (getState, getApp, launchApp, getWindowState, manageWindows, createBrowserTab, getBrowserTab, getBrowser, cursor), sky (Sky macOS Window & Desktop APIs), agent.browsers, and nodeRepl (emitImage, emitMarkdown, write). Ideal for complex multi-window & multi-tab workflows with Promise.all.

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": {
      "code": "<code>"
    },
    "name": "js"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesTop-level async JavaScript statements to run in the persistent cua_repl context.
timeout_msNoExecution timeout in milliseconds (default 45000).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.0.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 burden. It discloses the single most important behavioral trait — top-level bindings persist across calls — and the namespace surface (including state-mutating members like launchApp and manageWindows). It omits error semantics, what happens to bindings after an exception, sandboxing/permission requirements, and the shape of returned results.

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?

Front-loaded with the core identification and the persistence rule, then the API inventory, then the ideal use case. The parenthetical namespace enumerations are dense but each earns its place by telling the agent what is callable; nothing is redundant.

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?

For a high-complexity, unannotated, no-output-schema tool, the definition covers the environment, statefulness, available APIs, and the scenario where it beats granular tools. Remaining gaps are failure behavior and return/output conventions, which matter but are secondary to knowing what can be called.

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 100%, so `code` and `timeout_ms` (default 45000) are already fully documented in the schema. The description adds context about the execution environment the code runs in (persistent cua_repl with cua/sky/agent.browsers/nodeRepl in scope), which is useful but does not add syntax or semantic detail beyond the schema.

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 identifies the tool as a persistent JavaScript REPL (cua_repl) and enumerates the API surface available inside it (cua, sky, agent.browsers, nodeRepl), so an agent knows this executes arbitrary JS against a CUA/browser/window context. It stops short of naming the dedicated siblings (browser_open_tab, manage_windows, etc.) that overlap with those namespaces, so differentiation is implied rather than stated.

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?

"Ideal for complex multi-window & multi-tab workflows with Promise.all" gives a positive usage signal, and "persistent" implies reuse across calls. However, there is no explicit when-not guidance, no mention of js_reset for clearing state, and no direction on when to prefer the dedicated single-purpose siblings over raw JS.

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