Skip to main content
Glama

mac_run

Run AppleScript, shell commands, clicks, typing, and keypresses on macOS to automate tasks. Enables AI agents to control a Mac without manual input.

Instructions

Run an AppleScript/JXA/shell command or send click/type/keypress to macOS.

Supported actionTypes: applescript, jxa, shell, open, click, type, keypress.

Examples:

  • Open Safari: { actionType: "open", target: "Safari" }

  • Type text: { actionType: "type", text: "hello world" }

  • Cmd+C: { actionType: "keypress", text: "cmd+c" }

  • Run AppleScript: { actionType: "applescript", script: 'tell application "Finder" to activate', appContext: "Finder" }

  • List files: { actionType: "shell", command: "ls -la ~/Documents" }

Limitations:

  • Requires Accessibility + Automation permissions for click/type/keypress and AS targeting other apps.

  • Cannot bypass the lock screen.

  • Dangerous shell patterns (rm -rf /, curl|sh, sudo, etc.) are blocked by the sandbox.

  • Set appContext for the best self-learning: errors get classified per-app and reliable hints are auto-prepended on subsequent calls.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xNoX coordinate (required for click)
yNoY coordinate (required for click)
textNoText to type or key combo like "cmd+c" (required for type/keypress)
dryRunNoValidate without executing
scriptNoAppleScript or JXA code (required for applescript/jxa)
targetNoApp name, URL, or file path (required for open)
commandNoShell command (required for shell)
timeoutNoTimeout in ms (100-30000, default: 10000)
actionTypeYesType of action to execute
appContextNoTarget application name for context
Behavior4/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 behavioral traits. It clearly mentions permission requirements, security exclusions, and the self-learning behavior of appContext. It lacks details on return values or error handling, which could be useful, but the description is notably transparent for a command 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?

The description is well-organized and appropriately sized for a tool with 10 parameters and 7 action types. It starts with a clear summary, lists supported actions, provides 5 diverse examples, and ends with a concise bullet list of limitations. Every sentence serves a purpose, and the structure aids scannability.

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?

The description covers the tool's capabilities, limitations, and usage patterns comprehensively. It does not describe the output/return format, but since there is no output schema, this is a minor gap. Overall, it provides enough context for an agent to select and invoke the tool correctly for most cases.

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 input schema already provides 100% description coverage for all 10 parameters. The description adds value via concrete examples that map actionType to required params, and it explains the appContext param's role in self-learning, which goes beyond the schema description. This enriches the semantics of the parameters.

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 purpose: 'Run an AppleScript/JXA/shell command or send click/type/keypress to macOS.' It enumerates all supported action types, distinguishing this as a general execution tool. The examples and limitations further clarify its scope, making it distinct from sibling tools like mac_state or mac_find_ui.

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 on when to use the tool by listing action types and showing examples. It also highlights important prerequisites (Accessibility/Automation permissions) and limitations (cannot bypass lock screen, dangerous shell patterns blocked). However, it does not explicitly compare against alternative sibling tools or state when not to use this tool in favor of another.

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/leesgit/mac-pilot-mcp'

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