shortcuts_list_shortcuts
Retrieve a list of available macOS shortcuts with customizable limits, enabling streamlined automation and interaction via AppleScript-based workflows.
Instructions
[Shortcuts operations] List all available shortcuts with optional limit
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Optional limit on the number of shortcuts to return |
Implementation Reference
- src/categories/shortcuts.ts:43-88 (handler)Handler for 'shortcuts_list_shortcuts' tool: defines schema (optional 'limit' param) and generates AppleScript to list shortcuts from Shortcuts app, format as JSON, with error handling.{ name: "list_shortcuts", description: "List all available shortcuts with optional limit", schema: { type: "object", properties: { limit: { type: "number", description: "Optional limit on the number of shortcuts to return", }, }, }, script: (args) => ` try tell application "Shortcuts" set shortcutNames to name of every shortcut ${args.limit ? ` -- Apply limit if specified if (count of shortcutNames) > ${args.limit} then set shortcutNames to items 1 through ${args.limit} of shortcutNames end if ` : ``} end tell -- Convert to JSON string manually set jsonOutput to "{" set jsonOutput to jsonOutput & "\\"status\\": \\"success\\"," set jsonOutput to jsonOutput & "\\"shortcuts\\": [" repeat with i from 1 to count of shortcutNames set currentName to item i of shortcutNames set jsonOutput to jsonOutput & "{\\"name\\": \\"" & currentName & "\\"}" if i < count of shortcutNames then set jsonOutput to jsonOutput & ", " end if end repeat set jsonOutput to jsonOutput & "]}" return jsonOutput on error errMsg return "{\\"status\\": \\"error\\", \\"message\\": \\"" & errMsg & "\\"}" end try `, },
- src/index.ts:33-33 (registration)Registers the 'shortcuts' category (containing 'list_shortcuts' script) with the AppleScriptFramework server instance.server.addCategory(shortcutsCategory);
- src/framework.ts:222-231 (registration)Dynamically generates MCP tool list entries for all category scripts, constructing full name as 'category_script' (e.g., 'shortcuts_list_shortcuts') with schema from script definition.tools: this.categories.flatMap((category) => category.scripts.map((script) => ({ name: `${category.name}_${script.name}`, // Changed from dot to underscore description: `[${category.description}] ${script.description}`, inputSchema: script.schema || { type: "object", properties: {}, }, })), ),
- src/framework.ts:275-281 (handler)Generic MCP tool call handler: parses tool name (category_script), generates script content from script.script(args), executes via osascript, returns result. Specific to shortcuts_list_shortcuts via category/script lookup.const scriptContent = typeof script.script === "function" ? script.script(request.params.arguments) : script.script; const result = await this.executeScript(scriptContent);