Skip to main content
Glama
Szowesgad

automator-mcp

run_applescript

Execute AppleScript code on macOS to automate tasks, control applications, and perform system operations through the automator-mcp server.

Instructions

Execute AppleScript code on macOS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesAppleScript code to execute

Implementation Reference

  • Executes the provided AppleScript code using the `osascript` command via Node.js `execSync`, with single quote escaping for safety. Returns the result as MCP content or throws an error.
    async runAppleScript(script) { try { const result = execSync(`osascript -e '${script.replace(/'/g, "'\"'\"'")}'`, { encoding: 'utf8', }); return { content: [ { type: 'text', text: result.trim() || 'Script executed successfully', }, ], }; } catch (error) { throw new Error(`AppleScript error: ${error.message}`); } }
  • src/index.js:37-50 (registration)
    Registers the 'run_applescript' tool in the ListTools response, including name, description, and input schema.
    { name: 'run_applescript', description: 'Execute AppleScript code on macOS', inputSchema: { type: 'object', properties: { script: { type: 'string', description: 'AppleScript code to execute', }, }, required: ['script'], }, },
  • Defines the input schema for the 'run_applescript' tool, requiring a 'script' property of type string.
    inputSchema: { type: 'object', properties: { script: { type: 'string', description: 'AppleScript code to execute', }, }, required: ['script'], },
  • Dispatches calls to the 'run_applescript' tool by invoking the runAppleScript method in the CallToolRequest handler.
    case 'run_applescript': return await this.runAppleScript(args.script);

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/Szowesgad/automator-mcp'

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