Skip to main content
Glama

launch_mac_app

Launch macOS applications by specifying the full path to the .app bundle. Provide the appPath parameter to open applications on Mac systems.

Instructions

Launches a macOS application. IMPORTANT: You MUST provide the appPath parameter. Example: launch_mac_app({ appPath: '/path/to/your/app.app' }) Note: In some environments, this tool may be prefixed as mcp0_launch_macos_app.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appPathYesPath to the macOS .app bundle to launch (full path to the .app directory)
argsNoAdditional arguments to pass to the app

Implementation Reference

  • The asynchronous handler function that implements the core logic for the 'launch_mac_app' tool. It validates the appPath, checks if the file exists, constructs an 'open' command (optionally with args), executes it using promisified exec, and returns success or error responses with markdown text.
      async (params): Promise<ToolResponse> => {
        // Validate required parameters
        const appPathValidation = validateRequiredParam('appPath', params.appPath);
        if (!appPathValidation.isValid) {
          return appPathValidation.errorResponse!;
        }
    
        // Validate that the app file exists
        const fileExistsValidation = await validateFileExists(params.appPath);
        if (!fileExistsValidation.isValid) {
          return fileExistsValidation.errorResponse!;
        }
    
        log('info', `Starting launch macOS app request for ${params.appPath}`);
    
        try {
          // Construct the command
          let command = `open "${params.appPath}"`;
    
          // Add any additional arguments if provided
          if (params.args && params.args.length > 0) {
            command += ` --args ${params.args.join(' ')}`;
          }
    
          // Execute the command
          await execPromise(command);
    
          // Return success response
          return {
            content: [
              {
                type: 'text',
                text: `✅ macOS app launched successfully: ${params.appPath}`,
              },
            ],
          };
        } catch (error) {
          // Handle errors
          const errorMessage = error instanceof Error ? error.message : String(error);
          log('error', `Error during launch macOS app operation: ${errorMessage}`);
          return {
            content: [
              {
                type: 'text',
                text: `❌ Launch macOS app operation failed: ${errorMessage}`,
              },
            ],
          };
        }
      },
    );
  • Zod schema defining the input parameters for the 'launch_mac_app' tool: required 'appPath' string and optional 'args' array of strings.
    {
      appPath: z
        .string()
        .describe('Path to the macOS .app bundle to launch (full path to the .app directory)'),
      args: z.array(z.string()).optional().describe('Additional arguments to pass to the app'),
    },
  • The registerLaunchMacOSAppTool function registers the 'launch_mac_app' tool on the MCP server, providing name, description, input schema, and handler.
    export function registerLaunchMacOSAppTool(server: McpServer): void {
      server.tool(
        'launch_mac_app',
        "Launches a macOS application. IMPORTANT: You MUST provide the appPath parameter. Example: launch_mac_app({ appPath: '/path/to/your/app.app' }) Note: In some environments, this tool may be prefixed as mcp0_launch_macos_app.",
        {
          appPath: z
            .string()
            .describe('Path to the macOS .app bundle to launch (full path to the .app directory)'),
          args: z.array(z.string()).optional().describe('Additional arguments to pass to the app'),
        },
        async (params): Promise<ToolResponse> => {
          // Validate required parameters
          const appPathValidation = validateRequiredParam('appPath', params.appPath);
          if (!appPathValidation.isValid) {
            return appPathValidation.errorResponse!;
          }
    
          // Validate that the app file exists
          const fileExistsValidation = await validateFileExists(params.appPath);
          if (!fileExistsValidation.isValid) {
            return fileExistsValidation.errorResponse!;
          }
    
          log('info', `Starting launch macOS app request for ${params.appPath}`);
    
          try {
            // Construct the command
            let command = `open "${params.appPath}"`;
    
            // Add any additional arguments if provided
            if (params.args && params.args.length > 0) {
              command += ` --args ${params.args.join(' ')}`;
            }
    
            // Execute the command
            await execPromise(command);
    
            // Return success response
            return {
              content: [
                {
                  type: 'text',
                  text: `✅ macOS app launched successfully: ${params.appPath}`,
                },
              ],
            };
          } catch (error) {
            // Handle errors
            const errorMessage = error instanceof Error ? error.message : String(error);
            log('error', `Error during launch macOS app operation: ${errorMessage}`);
            return {
              content: [
                {
                  type: 'text',
                  text: `❌ Launch macOS app operation failed: ${errorMessage}`,
                },
              ],
            };
          }
        },
      );
    }
  • Configuration entry in the toolRegistrations array that includes registerLaunchMacOSAppTool, associating it with workflow groups and an enabling environment variable. This leads to the tool being registered via registerIfEnabled in registerTools.
      register: registerLaunchMacOSAppTool,
      groups: [ToolGroup.MACOS_WORKFLOW, ToolGroup.APP_DEPLOYMENT],
      envVar: 'XCODEBUILDMCP_TOOL_LAUNCH_MACOS_APP',
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the mandatory 'appPath' and a note about potential environment prefixes, but fails to describe critical behaviors such as permissions needed, whether the app runs in foreground/background, error handling, or system impacts. This leaves significant gaps for a tool that launches applications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, followed by important usage notes and an example. It is relatively concise with three sentences, but the note about environment prefixes could be considered slightly extraneous. Overall, it avoids unnecessary verbosity and structures information effectively.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of launching applications and lack of annotations or output schema, the description is incomplete. It does not cover behavioral aspects like system interactions, success/failure responses, or integration with sibling tools. For a tool with potential system-level effects, more context is needed to ensure safe and correct usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('appPath' and 'args') thoroughly. The description adds minimal value by emphasizing the requirement for 'appPath' and providing an example, but does not elaborate on parameter semantics beyond what the schema provides. Baseline 3 is appropriate given high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Launches a macOS application.' It specifies the verb ('launches') and resource ('macOS application'), making the intent unambiguous. However, it does not explicitly differentiate from sibling tools like 'launch_app_sim' or 'launch_app_logs_sim', which appear to be simulator-specific, so it misses full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some implied usage guidance by emphasizing the 'appPath' parameter as mandatory and giving an example, but it does not explicitly state when to use this tool versus alternatives like 'launch_app_sim' for simulators. No exclusions or clear alternatives are mentioned, leaving usage context partially defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/SampsonKY/XcodeBuildMCP'

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