shortcuts_list_shortcuts
Retrieve available macOS shortcuts through AppleScript integration, optionally limiting results for focused access.
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:55-87 (handler)Generates AppleScript to list all shortcuts (with optional limit), formats names as JSON array.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/categories/shortcuts.ts:46-54 (schema)Defines input schema for the tool, accepting optional 'limit' parameter of type number.schema: { type: "object", properties: { limit: { type: "number", description: "Optional limit on the number of shortcuts to return", }, }, },
- src/index.ts:33-33 (registration)Registers the 'shortcuts' category containing the 'list_shortcuts' script, enabling the tool 'shortcuts_list_shortcuts'.server.addCategory(shortcutsCategory);
- src/framework.ts:223-230 (registration)Dynamically generates MCP tool list entries, constructing tool name as '{category}_{script}' e.g. 'shortcuts_list_shortcuts'.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-294 (handler)Executes the tool by invoking the script generator function with arguments and running the resulting AppleScript via osascript.const scriptContent = typeof script.script === "function" ? script.script(request.params.arguments) : script.script; const result = await this.executeScript(scriptContent); this.log("info", "Tool execution completed successfully", { tool: toolName, resultLength: result.length }); return { content: [ { type: "text", text: result, }, ], };