Skip to main content
Glama

open_application

Launch macOS applications by name or bundle identifier with fuzzy matching support for quick access to desktop software.

Instructions

Launch an application by name or bundle identifier. App name supports fuzzy matching (e.g. 'chrome' → 'Google Chrome').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesApplication name (e.g. "Safari") or bundle identifier (e.g. "com.apple.Safari").

Implementation Reference

  • The handler function `handleOpenApplication` performs the logic to open an application using the `open` command, supporting both bundle identifiers and application names.
    async function handleOpenApplication(
      args: Record<string, unknown>,
    ): Promise<CallToolResult> {
      const parsed = OpenApplicationInputSchema.parse(args);
      // Skip resolution for bundle IDs — they must be passed verbatim
      const name = isBundleId(parsed.name)
        ? parsed.name
        : await resolveAppName(parsed.name);
    
      // Determine whether to use -a (app name) or -b (bundle ID)
      const flag = isBundleId(name) ? "-b" : "-a";
    
      try {
        await execFileAsync("open", [flag, name], {
          timeout: OPEN_COMMAND_TIMEOUT_MS,
        });
      } catch (error: unknown) {
        const msg = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: false,
                error: `Failed to open application "${name}": ${msg}`,
              }),
            },
          ],
          isError: true,
        };
      }
    
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify({ success: true, app: name }),
          },
        ],
      };
    }
  • Zod schema definition for `open_application` input validation.
    const OpenApplicationInputSchema = z.object({
      name: z
        .string()
        .max(1_000)
        .describe(
          'Application name (e.g. "Safari") or bundle identifier (e.g. "com.apple.Safari").',
        ),
    });
  • Registration definition for the `open_application` tool.
      {
        name: "open_application",
        description:
          "Launch an application by name or bundle identifier. App name supports fuzzy matching (e.g. 'chrome' → 'Google Chrome').",
        inputSchema: zodToToolInputSchema(OpenApplicationInputSchema),
        annotations: {
          readOnlyHint: false,
          destructiveHint: true,
        },
      },
    ];
  • Handler mapping where `open_application` is connected to its handler via an enqueue wrapper.
    export const windowToolHandlers: Record<
      string,
      (args: Record<string, unknown>) => Promise<CallToolResult>
    > = {
      list_windows: (args) => enqueue(() => handleListWindows(args)),
      focus_window: (args) => enqueue(() => handleFocusWindow(args)),
      open_application: (args) => enqueue(() => handleOpenApplication(args)),

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/antbotlab/mac-use-mcp'

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