Skip to main content
Glama
TrueOleg

MCP Mac Apps Server

by TrueOleg

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
NameRequiredDescriptionDefault
pathYesПуть к файлу или URL
appNameYesИмя приложения для открытия файла

Implementation Reference

  • 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)}`
        );
      }
    }
  • 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}"'
  • 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"],
      },
  • 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
      );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TrueOleg/MCP-expirements'

If you have feedback or need assistance with the MCP directory API, please join our Discord server