finder_get_current_folder
Retrieve the path of the active Finder window on macOS to identify the current working directory for file operations.
Instructions
Get path of currently viewed folder in frontmost Finder window
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:713-747 (handler)Handler function that executes osascript command to retrieve the POSIX path of the target folder in the frontmost Finder window.case 'finder_get_current_folder': try { const command = `osascript -e 'tell application "Finder" to get POSIX path of (target of front window as alias)'`; const { stdout, stderr } = await execAsync(command); if (stderr.trim()) { return { content: [ { type: 'text', text: `Error getting current folder: ${stderr.trim()}`, }, ], }; } const folderPath = stdout.trim(); return { content: [ { type: 'text', text: `Current folder: ${folderPath}`, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error executing current folder command: ${error.message}`, }, ], }; }
- src/index.ts:61-67 (registration)Tool registration in the ListTools response, including name, description, and empty input schema.name: 'finder_get_current_folder', description: 'Get path of currently viewed folder in frontmost Finder window', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:63-66 (schema)Input schema definition for the tool (no parameters required).inputSchema: { type: 'object', properties: {}, },