run_shortcut
Execute Apple Shortcuts automations by name to automate tasks on Apple devices, with optional input parameters for customization.
Instructions
Run a Shortcuts automation by name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the shortcut to run | |
| input | No | Optional input to pass to the shortcut |
Implementation Reference
- src/index.ts:77-106 (handler)The handler case for 'run_shortcut' tool, which constructs and executes a 'shortcuts run' command using execSync, handling input and errors.case "run_shortcut": { try { const command = args.input ? `shortcuts run "${args.name}" -i "${args.input}"` : `shortcuts run "${args.name}"`; console.error("MCP shortcuts: Running command:", command); const stdout = execSync(command).toString(); return { content: [ { type: "text", text: stdout || "Shortcut executed successfully", }, ], isError: false, }; } catch (error) { return { content: [ { type: "text", text: `Failed to run shortcut: ${(error as Error).message}`, }, ], isError: true, }; } }
- src/index.ts:18-30 (schema)Tool definition including name, description, and input schema for 'run_shortcut' in the TOOLS array.name: "run_shortcut", description: "Run a Shortcuts automation by name", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the shortcut to run" }, input: { type: "string", description: "Optional input to pass to the shortcut", }, }, required: ["name"], },
- src/index.ts:164-166 (registration)Registration of the tools list, which includes the 'run_shortcut' tool via the TOOLS array.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
- src/index.ts:168-170 (registration)Registration of the CallToolRequestSchema handler, which dispatches to the 'handleToolCall' function containing the 'run_shortcut' logic.server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}) );