open_file_with_app
Opens files or URLs in specified macOS applications using the MCP Mac Apps Server. Control which app opens your content through voice or text commands.
Instructions
Открывает файл или URL в указанном приложении
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Путь к файлу или URL | |
| appName | Yes | Имя приложения для открытия файла |
Implementation Reference
- src/index.ts:500-516 (handler)TypeScript handler function that opens a file with the specified macOS application using the 'open -a' command.private async openFileWithApp(path: string, appName: string) { try { await execAsync(`open -a "${appName}" "${path}"`); return { content: [ { type: "text", text: `Файл "${path}" открыт в приложении "${appName}"`, }, ], }; } catch (error) { throw new Error( `Не удалось открыть файл: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/server.py:358-364 (handler)Python handler function that opens a file with the specified macOS application using the 'open -a' command.def open_file_with_app(path: str, app_name: str) -> str: """Opens file in specified application""" stdout, stderr = exec_command(f'open -a "{app_name}" "{path}"') if stderr: raise Exception(f"Failed to open file: {stderr}") return f'File "{path}" opened in application "{app_name}"'
- src/index.ts:113-129 (schema)TypeScript input schema definition for the open_file_with_app tool.name: "open_file_with_app", description: "Открывает файл или URL в указанном приложении", inputSchema: { type: "object", properties: { path: { type: "string", description: "Путь к файлу или URL", }, appName: { type: "string", description: "Имя приложения для открытия файла", }, }, required: ["path", "appName"], }, },
- src/server.py:100-116 (schema)Python input schema definition for the open_file_with_app tool."name": "open_file_with_app", "description": "Opens file or URL in specified application", "inputSchema": { "type": "object", "properties": { "path": { "type": "string", "description": "Path to file or URL", }, "appName": { "type": "string", "description": "Application name to open file with", }, }, "required": ["path", "appName"], }, },
- src/index.ts:323-327 (registration)TypeScript tool dispatcher switch case that calls the handler.case "open_file_with_app": return await this.openFileWithApp( args?.path as string, args?.appName as string );