Skip to main content
Glama

Run AppleScript / JXA

run_applescript
Destructive

Execute AppleScript or JavaScript for Automation snippets to control scriptable macOS apps. Requires admin mode and MACCTL_ALLOW_EXEC=true to run.

Instructions

Run an AppleScript (or JavaScript for Automation) snippet via osascript. Powerful — can drive any scriptable app. Requires admin mode AND MACCTL_ALLOW_EXEC=true.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesThe AppleScript (or JXA) source.
languageNoScript language.AppleScript

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already mark destructiveHint=true and readOnlyHint=false, so the description does not need to restate those. It adds valuable context by warning that the tool is 'Powerful' and by specifying the admin and environment-variable requirements for execution. This goes beyond the structured annotations by addressing authentication/configuration needs.

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 two sentences with no wasted words. The core action is front-loaded, followed by the power caveat and then the prerequisite. Every phrase adds distinct value and 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 tool with only two parameters, an output schema absent, and annotations covering destructive behavior, the description is reasonably complete. It covers purpose, capabilities, and essential prerequisites. It does not describe return values or error behavior, but given osascript's well-known behavior and the schema's completeness, this is a minor gap.

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 description coverage is 100%, so the schema already documents both parameters. The description reinforces that the script can be AppleScript or JXA ('JavaScript for Automation'), which maps to the language enum, but it does not add meaningful detail beyond the schema. Baseline 3 is appropriate.

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 a specific verb and resource: 'Run an AppleScript (or JavaScript for Automation) snippet via osascript.' This distinguishes it from sibling tools like run_command, write_file, or click by naming the exact scripting mechanism and scope. The additional phrase 'can drive any scriptable app' further clarifies its intent.

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 description provides clear prerequisites—'Requires admin mode AND MACCTL_ALLOW_EXEC=true'—and implies use for scripting apps with 'can drive any scriptable app.' However, it does not explicitly name alternatives or state when not to use this tool versus run_command or other execution tools, leaving some selection judgment to the agent.

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