Run Shortcut
run_shortcutRun any Siri Shortcut by providing its exact name and optional text input.
Instructions
Run a Siri Shortcut by name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Shortcut name (exact match) | |
| input | No | Optional text input for the shortcut |
Implementation Reference
- src/shortcuts/tools.ts:76-82 (handler)The handler/executor for the run_shortcut tool. Calls runJxa with runShortcutScript.
async ({ name, input }) => { try { return okLinked("run_shortcut", await runJxa(runShortcutScript(name, input))); } catch (e) { return errJxaFor("run shortcut", e); } }, - src/shortcuts/tools.ts:66-75 (schema)Input/output schema definition for run_shortcut: requires 'name' (string, max 500), optional 'input' (string, max 10000).
{ title: "Run Shortcut", description: "Run a Siri Shortcut by name. Optionally provide text input. Returns the shortcut's output. Note: shortcuts may trigger UI prompts or perform system actions.", inputSchema: { name: z.string().max(500).describe("Shortcut name (exact match)"), input: z.string().max(10000).optional().describe("Optional text input for the shortcut"), }, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }, }, - src/shortcuts/tools.ts:64-83 (registration)Registration of the run_shortcut tool via server.registerTool in the registerShortcutsTools function.
server.registerTool( "run_shortcut", { title: "Run Shortcut", description: "Run a Siri Shortcut by name. Optionally provide text input. Returns the shortcut's output. Note: shortcuts may trigger UI prompts or perform system actions.", inputSchema: { name: z.string().max(500).describe("Shortcut name (exact match)"), input: z.string().max(10000).optional().describe("Optional text input for the shortcut"), }, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }, }, async ({ name, input }) => { try { return okLinked("run_shortcut", await runJxa(runShortcutScript(name, input))); } catch (e) { return errJxaFor("run shortcut", e); } }, ); - src/shortcuts/scripts.ts:49-57 (helper)Helper function that generates a JXA script snippet to run a shortcut via the macOS 'shortcuts run' CLI command.
export function runShortcutScript(name: string, input?: string): string { const inputPart = input !== undefined ? ` --input-type text --input "${escJxaShell(input)}"` : ""; return ` const app = Application.currentApplication(); app.includeStandardAdditions = true; const output = app.doShellScript('shortcuts run "${escJxaShell(name)}"${inputPart}'); JSON.stringify({shortcut: '${esc(name)}', output: output}); `; }