Skip to main content
Glama
Szowesgad

automator-mcp

run_jxa

Execute JavaScript for Automation (JXA) code to control macOS system tasks and automate workflows directly from AI assistants.

Instructions

Execute JavaScript for Automation (JXA) code on macOS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesJXA JavaScript code to execute

Implementation Reference

  • The core handler function that executes the JXA script using osascript with JavaScript language flag.
    async runJXA(script) { try { const result = execSync(`osascript -l JavaScript -e '${script.replace(/'/g, "'\"'\"'")}'`, { encoding: 'utf8', }); return { content: [ { type: 'text', text: result.trim() || 'Script executed successfully', }, ], }; } catch (error) { throw new Error(`JXA error: ${error.message}`); } }
  • src/index.js:51-64 (registration)
    Registration of the 'run_jxa' tool in the ListTools response, including description and input schema.
    { name: 'run_jxa', description: 'Execute JavaScript for Automation (JXA) code on macOS', inputSchema: { type: 'object', properties: { script: { type: 'string', description: 'JXA JavaScript code to execute', }, }, required: ['script'], }, },
  • Input schema definition for the 'run_jxa' tool, specifying the 'script' parameter.
    inputSchema: { type: 'object', properties: { script: { type: 'string', description: 'JXA JavaScript code to execute', }, }, required: ['script'], },
  • Dispatch handler in CallToolRequest that routes 'run_jxa' calls to the runJXA method.
    case 'run_jxa': return await this.runJXA(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