Duplicate Shortcut
duplicate_shortcutDuplicate any Siri Shortcut by specifying the original and new name. Creates an exact copy of the shortcut.
Instructions
Duplicate an existing Siri Shortcut.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the shortcut to duplicate (exact match) | |
| newName | Yes | Name for the duplicated shortcut |
Implementation Reference
- src/shortcuts/tools.ts:214-233 (registration)Registration of the duplicate_shortcut tool with its input schema (name, newName) and handler that calls duplicateShortcutScript via JXA.
server.registerTool( "duplicate_shortcut", { title: "Duplicate Shortcut", description: "Duplicate an existing Siri Shortcut. Exports the shortcut to a temporary file and re-imports it with a new name.", inputSchema: { name: z.string().max(500).describe("Name of the shortcut to duplicate (exact match)"), newName: z.string().max(500).describe("Name for the duplicated shortcut"), }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }, }, async ({ name, newName }) => { try { return ok(await runJxa(duplicateShortcutScript(name, newName))); } catch (e) { return errJxaFor("duplicate shortcut", e); } }, ); - src/shortcuts/tools.ts:226-232 (handler)Handler function for duplicate_shortcut: runs the JXA script via runJxa and wraps result in ok() or errJxaFor().
async ({ name, newName }) => { try { return ok(await runJxa(duplicateShortcutScript(name, newName))); } catch (e) { return errJxaFor("duplicate shortcut", e); } }, - src/shortcuts/tools.ts:220-223 (schema)Input schema definition for duplicate_shortcut: requires 'name' (source shortcut) and 'newName' (duplicate name), both strings max 500 chars.
inputSchema: { name: z.string().max(500).describe("Name of the shortcut to duplicate (exact match)"), newName: z.string().max(500).describe("Name for the duplicated shortcut"), }, - src/shortcuts/scripts.ts:112-124 (helper)JXA script generator that exports the original shortcut to a temp file, imports it (creating a duplicate), then deletes the temp file.
export function duplicateShortcutScript(name: string, newName: string): string { const safeName = escJxaShell(newName).replace(/[^a-zA-Z0-9_-]/g, "_"); // Inline a unique temp file path so concurrent duplicates don't collide and // sandboxed runtimes can redirect via AIRMCP_TEMP_DIR. const tempFile = join(PATHS.TEMP_DIR, `${safeName}-${Date.now()}.shortcut`); return ` const app = Application.currentApplication(); app.includeStandardAdditions = true; app.doShellScript('shortcuts export "${escJxaShell(name)}" -o "${tempFile}" && shortcuts import "${tempFile}"'); app.doShellScript('rm -f "${tempFile}"'); JSON.stringify({original: '${esc(name)}', duplicate: '${esc(newName)}', success: true}); `; }