Skip to main content
Glama

exec

Destructive

Run JavaScript programs on a Windows PC to automate UI steps, loops, and screen-based branches; the call returns when the program finishes, stalls, asks, or times out.

Instructions

Run a JavaScript program on the computer (async; top-level await and return work). The computer runs it itself, step after step, and this call comes back only when it ends, gets stuck, asks, or waitSec passes. Use it for work that loops over rows or branches on what the screen shows; a straight sequence of steps is simpler as a plan (act { do: "run" }), and act's single actions are for one-off corrections. The program has no files, network or processes of its own, only these calls, each a tool run as you would run it (replies { ok, text, error, data }; opts are that tool's own arguments: window, nth, role, timeoutSec, …):

  • do: click(target, opts) · press(target) · type(target, text, opts) (target null: where the focus is) · fill({ label: value, … }) · keys("ctrl+s") · open(appOrUrl, opts) (opts.browser: "asctrl" for Asctrl's own browser, "user" for the user's through the extension)

  • wait and check: waitFor(text, opts) · waitGone(text) · expect(text, opts) (stops there if it doesn't show in 5 s) · shows(text) → true/false · until(() => condition, { timeoutSec, everyMs }) · until(">= 141 | <= 133", { x0, y0, x1, y1 }) (reads the number or text in that part of the latest screenshot about 8 times a second, goes on the moment a condition holds)

  • read: read(window) → text · look(window) → observe's reply

  • anything else: tool(name, args) · attempt(name, args) (returns a failure instead of stopping) · ask(question, details) → your answer · on(text, press) (a popup showing text that may turn up at any point: press that in it, in between steps) · sleep(ms) · log(…) · args (what you pass) Returns "Program is ": done (with what it returned), stuck (the action that failed, at its line, and why, with the windows that came and went), asking (its question), or running (waitSec passed). Stuck, it waits at that line: fix what is needed with act's single actions, then resume it by id (retry, skip, instead, code, abort); asking takes resume with answer. A text target that fits several controls or none is first put right on the computer where that needs no judgment (an on rule, a moment's wait), then chosen by the decision model when it is sure; only then does it stop for you. Skills: write the program over args (the rows, the values) and give learn; when it ends well it is kept on that computer, and skill: name runs it again with new args, no planning needed (query { what: "skills" } finds them). A program that ends well without learn is kept too, named after what it did (learn: false: not kept). A skill runs only when the window in front looks like one it was made in (force: true runs it anyway); one put right with instead is changed to match once that run ends well. pace: an input goes on the moment the screen reacts to it (react, default), "normal" waits until the screen is still, "fast" only for the program to take it (inputs known to bring nothing up).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNoGiven to the program as args (rows to go through, values to fill in)
paceNoHow long an input waits for the screen: react (default), normal, fast
forceNoWith skill: run it even if the window in front doesn't look like one it was made in
learnNoKeep the program as a skill when it ends well: a short name, and what it does in words a later search would use (the program, the task). false: don't keep it at all
skillNoRun this kept skill instead of a script (skills finds them); args are its args
scriptNoThe program's JavaScript (or skill)
waitSecNoWait up to this long before answering; default 30
timeoutSecNoLongest the program may run in all; default 600

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already flag this as non-read-only, destructive and open-world, but the description goes well beyond them: it enumerates the return contract ("Program <id> is <state>": done/stuck/asking/running), explains that a stuck program parks at the failing line and is resumed by id with retry/skip/instead/code/abort, that 'asking' needs resume with an answer, and that well-ended programs are silently retained as skills unless learn:false. What it omits is permission/auth requirements and any cost or rate implications of running arbitrary JS against a live desktop.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well front-loaded — purpose and the act/plan distinction come first, followed by a grouped API list — but the final skills paragraph is a dense run-on that compresses several distinct rules (naming, window matching, forced runs, instead rewrites) into ambiguous prose. Much of the length is earned by the API surface, yet readability suffers from cramming.

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

Completeness5/5

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

With no output schema and 8 optional parameters, the description carries the return-value burden and does so: state strings, what each state means, the resume path, and skill persistence are all spelled out. It also documents the in-program API surface, which an agent needs to write a valid script at all — nothing essential for correct invocation is missing.

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?

Schema coverage is 100%, so the baseline is 3, but the prose genuinely adds meaning: it clarifies that args is "what you pass" into the program, elaborates learn (kept skill named after what it did; learn:false not kept), explains the window-matching precondition behind force, and gives the screen-settling semantics of pace (react/normal/fast) that the enum alone does not convey.

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?

Opens with a specific verb and resource: "Run a JavaScript program on the computer", plus the key async trait (top-level await/return work). It explicitly contrasts itself with siblings — "a straight sequence of steps is simpler as a plan (act { do: 'run' }), and act's single actions are for one-off corrections" — so an agent can select between exec, act-as-plan, and single actions without opening another schema.

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

Usage Guidelines5/5

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

Gives an explicit when-to-use rule ("work that loops over rows or branches on what the screen shows") and explicit when-not alternatives (straight sequences belong in a plan, one-off fixes in act). It also covers the secondary mode (learn/skill reuse, force, query { what: 'skills' }) with the condition that triggers each.

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

Deploy Server

Other Tools