shortcuts_run_shortcut
Execute macOS shortcuts in the background using AppleScript integration. Provide a shortcut name and optional input to automate tasks without opening the Shortcuts app.
Instructions
[Shortcuts operations] Run a shortcut with optional input. Uses Shortcuts Events to run in background without opening the app.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the shortcut to run | |
| input | No | Optional input to provide to the shortcut |
Implementation Reference
- src/categories/shortcuts.ts:29-41 (handler)Handler function that generates AppleScript to run the named shortcut via Shortcuts Events app, optionally with input, and handles errors.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 `,
- src/categories/shortcuts.ts:15-28 (schema)Input schema for the tool: requires 'name' (string), optional 'input' (string).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 the 'run_shortcut' script by adding it to the MCP server.server.addCategory(shortcutsCategory);
- src/framework.ts:224-224 (registration)In the listTools handler, constructs the full tool name as '{category.name}_{script.name}', yielding 'shortcuts_run_shortcut'.name: `${category.name}_${script.name}`, // Changed from dot to underscore
- src/framework.ts:244-246 (registration)In the callTool handler, parses the tool name 'shortcuts_run_shortcut' by splitting on '_' to extract category 'shortcuts' and script 'run_shortcut'.const [categoryName, ...scriptNameParts] = toolName.split("_"); const scriptName = scriptNameParts.join("_"); // Rejoin in case script name has underscores