Skip to main content
Glama
eugenechen0514

mac-apps-launcher

launch_app

Quickly launch Mac applications by specifying the app name, enabling efficient app management directly from the macOS command line.

Instructions

Launch a Mac application by name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appNameYes

Implementation Reference

  • The launchApp function implements the core logic to launch a Mac application using the 'open' command.
    export async function launchApp(appName: string): Promise<boolean> {
      try {
        const fullAppName = appName.endsWith(".app") ? appName : `${appName}.app`;
        const appPath = join("/Applications", fullAppName);
        await execAsync(`open "${appPath}"`);
        return true;
      } catch (error) {
        console.error("Error launching application:", error);
        return false;
      }
    }
  • Zod input schema for the launch_app tool, requiring 'appName' as string.
    export const LaunchAppInputSchema = {
      appName: z.string(),
    };
  • tools.ts:50-75 (registration)
    Tool configuration object for 'launch_app' including name, description, annotations, schema reference, and thin wrapper callback that invokes the launchApp utility.
    const launchAppConfig: ToolConfig<typeof LaunchAppInputSchema> = {
      name: "launch_app",
      description: "Launch a Mac application by name",
      annotations: {
        title: "啟動應用程式",
        readOnlyHint: false, // 會修改系統狀態(啟動應用程式)
        destructiveHint: false, // 不執行破壞性操作
        idempotentHint: false, // 重複啟動可能有不同結果
        openWorldHint: true, // 與外部應用程式互動
      },
      schema: LaunchAppInputSchema,
      cb: async (args) => {
        const success = await launchApp(args.appName);
        const toolResult: CallToolResult = {
          content: [
            {
              type: "text",
              text: success
                ? "Application launched successfully"
                : "Failed to launch application",
            },
          ],
        };
        return toolResult;
      },
    };
  • tools.ts:103-107 (registration)
    Export of the tools array where launchAppConfig is registered alongside other tools for use in the MCP server.
    export const tools: ToolConfig<any>[] = [
      listApplicationsConfig,
      launchAppConfig,
      openWithAppConfig,
    ];
Install Server

Other Tools

Related Tools

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/eugenechen0514/mac-apps-launcher'

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