quick_action
Execute predefined tasks like compressing images, converting files to PDF, resizing images, extracting text, combining PDFs, or converting videos using specific action commands and file inputs on the automator-mcp server.
Instructions
Run a predefined quick action
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Quick action to perform | |
| files | Yes | File paths to process | |
| options | No | Action-specific options |
Implementation Reference
- src/index.js:289-330 (handler)Main handler for the 'quick_action' tool. Parses arguments, defines a map of specific quick action implementations, and dispatches to the appropriate one based on the 'action' parameter.async runQuickAction(args) { const { action, files, options = {} } = args; const quickActions = { compress_images: async () => { const script = ` tell application "Finder" set theFiles to {${files.map(f => `POSIX file "${f}"`).join(', ')}} end tell repeat with theFile in theFiles do shell script "sips -Z 1024 " & quoted form of POSIX path of theFile end repeat `; return this.runAppleScript(script); }, convert_to_pdf: async () => { const outputPath = options.outputPath || files[0].replace(/\.[^.]+$/, '.pdf'); const script = ` do shell script "convert ${files.map(f => `'${f}'`).join(' ')} '${outputPath}'" `; return this.runAppleScript(script); }, resize_images: async () => { const size = options.size || '800x600'; const script = ` repeat with filePath in {${files.map(f => `"${f}"`).join(', ')}} do shell script "sips -z ${size.split('x')[1]} ${size.split('x')[0]} " & filePath end repeat `; return this.runAppleScript(script); }, }; if (quickActions[action]) { return await quickActions[action](); } throw new Error(`Unknown quick action: ${action}`); }
- src/index.js:111-137 (schema)Input schema defining the parameters for the 'quick_action' tool, including the action enum, required files array, and optional options.inputSchema: { type: 'object', properties: { action: { type: 'string', enum: [ 'compress_images', 'convert_to_pdf', 'resize_images', 'extract_text_from_pdf', 'combine_pdfs', 'convert_video', ], description: 'Quick action to perform', }, files: { type: 'array', items: { type: 'string' }, description: 'File paths to process', }, options: { type: 'object', description: 'Action-specific options', }, }, required: ['action', 'files'], },
- src/index.js:108-138 (registration)Registration of the 'quick_action' tool in the list of available tools, including name, description, and full input schema.{ name: 'quick_action', description: 'Run a predefined quick action', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: [ 'compress_images', 'convert_to_pdf', 'resize_images', 'extract_text_from_pdf', 'combine_pdfs', 'convert_video', ], description: 'Quick action to perform', }, files: { type: 'array', items: { type: 'string' }, description: 'File paths to process', }, options: { type: 'object', description: 'Action-specific options', }, }, required: ['action', 'files'], }, },
- src/index.js:187-188 (registration)Dispatch registration in the CallToolRequestHandler switch statement that routes 'quick_action' calls to the runQuickAction method.case 'quick_action': return await this.runQuickAction(args);
- src/index.js:292-323 (helper)Helper object mapping specific quick action names to their implementation functions, which generate AppleScript and execute via runAppleScript.const quickActions = { compress_images: async () => { const script = ` tell application "Finder" set theFiles to {${files.map(f => `POSIX file "${f}"`).join(', ')}} end tell repeat with theFile in theFiles do shell script "sips -Z 1024 " & quoted form of POSIX path of theFile end repeat `; return this.runAppleScript(script); }, convert_to_pdf: async () => { const outputPath = options.outputPath || files[0].replace(/\.[^.]+$/, '.pdf'); const script = ` do shell script "convert ${files.map(f => `'${f}'`).join(' ')} '${outputPath}'" `; return this.runAppleScript(script); }, resize_images: async () => { const size = options.size || '800x600'; const script = ` repeat with filePath in {${files.map(f => `"${f}"`).join(', ')}} do shell script "sips -z ${size.split('x')[1]} ${size.split('x')[0]} " & filePath end repeat `; return this.runAppleScript(script); }, };