Skip to main content
Glama

shortcuts_run_shortcut

Execute macOS Shortcuts in the background without opening the app by providing the shortcut name and optional input via AppleScript integration.

Instructions

[Shortcuts operations] Run a shortcut with optional input. Uses Shortcuts Events to run in background without opening the app.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputNoOptional input to provide to the shortcut
nameYesName of the shortcut to run

Implementation Reference

  • Core definition of the 'run_shortcut' script in shortcuts category, which implements the 'shortcuts_run_shortcut' MCP tool. Includes input schema and dynamic AppleScript handler template.
    { name: "run_shortcut", description: "Run a shortcut with optional input. Uses Shortcuts Events to run in background without opening the app.", schema: { type: "object", properties: { name: { type: "string", description: "Name of the shortcut to run", }, input: { type: "string", description: "Optional input to provide to the shortcut", }, }, required: ["name"], }, script: (args) => ` try tell application "Shortcuts Events" ${args.input ? `run shortcut "${args.name}" with input "${args.input}"` : `run shortcut "${args.name}"` } end tell return "Shortcut '${args.name}' executed successfully" on error errMsg return "Failed to run shortcut: " & errMsg end try `, },
  • Input schema validation for shortcuts_run_shortcut tool
    schema: { type: "object", properties: { name: { type: "string", description: "Name of the shortcut to run", }, input: { type: "string", description: "Optional input to provide to the shortcut", }, }, required: ["name"], },
  • src/index.ts:33-33 (registration)
    Registers the shortcuts category (containing run_shortcut) with the MCP server
    server.addCategory(shortcutsCategory);
  • Dynamically constructs MCP tool names as 'category_script' (e.g., shortcuts_run_shortcut) and registers schema for listTools endpoint
    name: `${category.name}_${script.name}`, // Changed from dot to underscore description: `[${category.description}] ${script.description}`, inputSchema: script.schema || { type: "object", properties: {}, }, })),
  • MCP CallTool handler: parses tool name 'shortcuts_run_shortcut', locates script, generates AppleScript, and executes it via osascript
    const toolName = request.params.name; this.log("info", "Tool execution requested", { tool: toolName, hasArguments: !!request.params.arguments }); try { // Split on underscore instead of dot const [categoryName, ...scriptNameParts] = toolName.split("_"); const scriptName = scriptNameParts.join("_"); // Rejoin in case script name has underscores const category = this.categories.find((c) => c.name === categoryName); if (!category) { this.log("warning", "Category not found", { categoryName }); throw new McpError( ErrorCode.MethodNotFound, `Category not found: ${categoryName}`, ); } const script = category.scripts.find((s) => s.name === scriptName); if (!script) { this.log("warning", "Script not found", { categoryName, scriptName }); throw new McpError( ErrorCode.MethodNotFound, `Script not found: ${scriptName}`, ); } this.log("debug", "Generating script content", { categoryName, scriptName, isFunction: typeof script.script === "function" }); const scriptContent = typeof script.script === "function" ? script.script(request.params.arguments) : script.script; const result = await this.executeScript(scriptContent);

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/joshrutkowski/applescript-mcp'

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