open_file_with_app
Open files or URLs in specific macOS applications using this MCP server tool. Specify the file path and application name to launch content directly.
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 executes the open_file_with_app tool by running the 'open -a' command to open the specified path in the given app.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-363 (handler)Python handler function that executes the open_file_with_app tool using subprocess exec_command to run 'open -a' for opening file in app.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:112-128 (schema)Input schema definition for the open_file_with_app tool in the TypeScript listTools response.{ 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:99-115 (schema)Input schema definition for the open_file_with_app tool in the Python get_tools() function.{ "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)Dispatch/registration case in TypeScript CallToolRequestSchema handler that routes to the openFileWithApp method.case "open_file_with_app": return await this.openFileWithApp( args?.path as string, args?.appName as string );