Skip to main content
Glama

get_sim_app_path_name_proj

Retrieve the app bundle path for a specific simulator by name using an Xcode project file. Requires project path, scheme, platform, and simulator name parameters.

Instructions

Gets the app bundle path for a simulator by name using a project file. IMPORTANT: Requires projectPath, scheme, platform, and simulatorName. Example: get_sim_app_path_name_proj({ projectPath: '/path/to/project.xcodeproj', scheme: 'MyScheme', platform: 'iOS Simulator', simulatorName: 'iPhone 16' })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the .xcodeproj file (Required)
schemeYesThe scheme to use (Required)
platformYesThe target simulator platform (Required)
simulatorNameYesName of the simulator to use (e.g., 'iPhone 16') (Required)
configurationNoBuild configuration (Debug, Release, etc.)
useLatestOSNoWhether to use the latest OS version for the named simulator

Implementation Reference

  • Core handler function that executes the tool logic: constructs and runs xcodebuild -showBuildSettings with platform-specific destination, extracts BUILT_PRODUCTS_DIR and FULL_PRODUCT_NAME to compute app path.
    async function _handleGetAppPathLogic(params: {
      workspacePath?: string;
      projectPath?: string;
      scheme: string;
      configuration: string;
      platform: XcodePlatform;
      simulatorName?: string;
      simulatorId?: string;
      useLatestOS: boolean;
      arch?: string;
    }): Promise<ToolResponse> {
      log('info', `Getting app path for scheme ${params.scheme} on platform ${params.platform}`);
    
      try {
        // Create the command array for xcodebuild with -showBuildSettings option
        const command = ['xcodebuild', '-showBuildSettings'];
    
        // Add the workspace or project
        if (params.workspacePath) {
          command.push('-workspace', params.workspacePath);
        } else if (params.projectPath) {
          command.push('-project', params.projectPath);
        }
    
        // Add the scheme and configuration
        command.push('-scheme', params.scheme);
        command.push('-configuration', params.configuration);
    
        // Handle destination based on platform
        const isSimulatorPlatform = [
          XcodePlatform.iOSSimulator,
          XcodePlatform.watchOSSimulator,
          XcodePlatform.tvOSSimulator,
          XcodePlatform.visionOSSimulator,
        ].includes(params.platform);
    
        let destinationString = '';
    
        if (isSimulatorPlatform) {
          if (params.simulatorId) {
            destinationString = `platform=${params.platform},id=${params.simulatorId}`;
          } else if (params.simulatorName) {
            destinationString = `platform=${params.platform},name=${params.simulatorName}${params.useLatestOS ? ',OS=latest' : ''}`;
          } else {
            return createTextResponse(
              `For ${params.platform} platform, either simulatorId or simulatorName must be provided`,
              true,
            );
          }
        } else if (params.platform === XcodePlatform.macOS) {
          destinationString = constructDestinationString(
            params.platform,
            undefined,
            undefined,
            false,
            params.arch,
          );
        } else if (params.platform === XcodePlatform.iOS) {
          destinationString = 'generic/platform=iOS';
        } else if (params.platform === XcodePlatform.watchOS) {
          destinationString = 'generic/platform=watchOS';
        } else if (params.platform === XcodePlatform.tvOS) {
          destinationString = 'generic/platform=tvOS';
        } else if (params.platform === XcodePlatform.visionOS) {
          destinationString = 'generic/platform=visionOS';
        } else {
          return createTextResponse(`Unsupported platform: ${params.platform}`, true);
        }
    
        command.push('-destination', destinationString);
    
        // Execute the command directly
        const result = await executeCommand(command, 'Get App Path');
    
        if (!result.success) {
          return createTextResponse(`Failed to get app path: ${result.error}`, true);
        }
    
        if (!result.output) {
          return createTextResponse('Failed to extract build settings output from the result.', true);
        }
    
        const buildSettingsOutput = result.output;
        const builtProductsDirMatch = buildSettingsOutput.match(/BUILT_PRODUCTS_DIR = (.+)$/m);
        const fullProductNameMatch = buildSettingsOutput.match(/FULL_PRODUCT_NAME = (.+)$/m);
    
        if (!builtProductsDirMatch || !fullProductNameMatch) {
          return createTextResponse(
            'Failed to extract app path from build settings. Make sure the app has been built first.',
            true,
          );
        }
    
        const builtProductsDir = builtProductsDirMatch[1].trim();
        const fullProductName = fullProductNameMatch[1].trim();
        const appPath = `${builtProductsDir}/${fullProductName}`;
    
        let nextStepsText = '';
        if (params.platform === XcodePlatform.macOS) {
          nextStepsText = `Next Steps:
    1. Get bundle ID: get_macos_bundle_id({ appPath: "${appPath}" })
    2. Launch the app: launch_macos_app({ appPath: "${appPath}" })`;
        } else if (params.platform === XcodePlatform.iOSSimulator) {
          nextStepsText = `Next Steps:
    1. Get bundle ID: get_ios_bundle_id({ appPath: "${appPath}" })
    2. Boot simulator: boot_simulator({ simulatorUuid: "SIMULATOR_UUID" })
    3. Install app: install_app_in_simulator({ simulatorUuid: "SIMULATOR_UUID", appPath: "${appPath}" })
    4. Launch app: launch_app_in_simulator({ simulatorUuid: "SIMULATOR_UUID", bundleId: "BUNDLE_ID" })`;
        } else if (params.platform === XcodePlatform.iOS) {
          nextStepsText = `Next Steps:
    1. Get bundle ID: get_ios_bundle_id({ appPath: "${appPath}" })
    2. Use Xcode to install the app on your connected iOS device`;
        }
    
        return {
          content: [
            {
              type: 'text',
              text: `✅ App path retrieved successfully: ${appPath}`,
            },
            {
              type: 'text',
              text: nextStepsText,
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log('error', `Error retrieving app path: ${errorMessage}`);
        return createTextResponse(`Error retrieving app path: ${errorMessage}`, true);
      }
    }
  • Function that registers the 'get_sim_app_path_name_proj' tool on the MCP server, defining its input schema, description, and handler.
    export function registerGetSimulatorAppPathByNameProjectTool(server: McpServer): void {
      type Params = BaseProjectParams & BaseAppPathSimulatorNameParams;
      registerTool<Params>(
        server,
        'get_sim_app_path_name_proj',
        "Gets the app bundle path for a simulator by name using a project file. IMPORTANT: Requires projectPath, scheme, platform, and simulatorName. Example: get_sim_app_path_name_proj({ projectPath: '/path/to/project.xcodeproj', scheme: 'MyScheme', platform: 'iOS Simulator', simulatorName: 'iPhone 16' })",
        {
          projectPath: projectPathSchema,
          scheme: schemeSchema,
          platform: platformSimulatorSchema,
          simulatorName: simulatorNameSchema,
          configuration: configurationSchema,
          useLatestOS: useLatestOSSchema,
        },
        async (params: Params) => {
          const projectValidation = validateRequiredParam('projectPath', params.projectPath);
          if (!projectValidation.isValid) return projectValidation.errorResponse!;
    
          const schemeValidation = validateRequiredParam('scheme', params.scheme);
          if (!schemeValidation.isValid) return schemeValidation.errorResponse!;
    
          const platformValidation = validateRequiredParam('platform', params.platform);
          if (!platformValidation.isValid) return platformValidation.errorResponse!;
    
          const simulatorNameValidation = validateRequiredParam('simulatorName', params.simulatorName);
          if (!simulatorNameValidation.isValid) return simulatorNameValidation.errorResponse!;
    
          return _handleGetAppPathLogic({
            ...params,
            configuration: params.configuration ?? 'Debug',
            useLatestOS: params.useLatestOS ?? true,
          });
        },
      );
    }
  • Zod schemas for input parameters used by the get_sim_app_path_name_proj tool: projectPath, scheme, platform, simulatorName, configuration, useLatestOS.
    export const workspacePathSchema = z.string().describe('Path to the .xcworkspace file (Required)');
    export const projectPathSchema = z.string().describe('Path to the .xcodeproj file (Required)');
    export const schemeSchema = z.string().describe('The scheme to use (Required)');
    export const configurationSchema = z
      .string()
      .optional()
      .describe('Build configuration (Debug, Release, etc.)');
    export const derivedDataPathSchema = z
      .string()
      .optional()
      .describe('Path where build products and other derived data will go');
    export const extraArgsSchema = z
      .array(z.string())
      .optional()
      .describe('Additional xcodebuild arguments');
    export const simulatorNameSchema = z
      .string()
      .describe("Name of the simulator to use (e.g., 'iPhone 16') (Required)");
    export const simulatorIdSchema = z
      .string()
      .describe('UUID of the simulator to use (obtained from listSimulators) (Required)');
    export const useLatestOSSchema = z
      .boolean()
      .optional()
      .describe('Whether to use the latest OS version for the named simulator');
    export const appPathSchema = z
      .string()
      .describe('Path to the .app bundle (full path to the .app directory)');
    export const bundleIdSchema = z
      .string()
      .describe("Bundle identifier of the app (e.g., 'com.example.MyApp')");
    export const launchArgsSchema = z
      .array(z.string())
      .optional()
      .describe('Additional arguments to pass to the app');
    export const preferXcodebuildSchema = z
      .boolean()
      .optional()
      .describe(
        'If true, prefers xcodebuild over the experimental incremental build system, useful for when incremental build system fails.',
      );
    
    export const platformDeviceSchema = z
      .enum([
        XcodePlatform.macOS,
        XcodePlatform.iOS,
        XcodePlatform.watchOS,
        XcodePlatform.tvOS,
        XcodePlatform.visionOS,
      ])
      .describe('The target device platform (Required)');
    
    export const platformSimulatorSchema = z
      .enum([
        XcodePlatform.iOSSimulator,
        XcodePlatform.watchOSSimulator,
        XcodePlatform.tvOSSimulator,
        XcodePlatform.visionOSSimulator,
      ])
      .describe('The target simulator platform (Required)');
  • Utility function used to register all MCP tools, wrapping the handler to match MCP server.tool signature.
    export function registerTool<T extends object>(
      server: McpServer,
      name: string,
      description: string,
      schema: Record<string, z.ZodType>,
      handler: (params: T) => Promise<ToolResponse>,
    ): void {
      // Create a wrapper handler that matches the signature expected by server.tool
      const wrappedHandler = (
        args: Record<string, unknown>,
        _extra: unknown,
      ): Promise<ToolResponse> => {
        // Assert the type *before* calling the original handler
        // This confines the type assertion to one place
        const typedParams = args as T;
        return handler(typedParams);
      };
    
      server.tool(name, description, schema, wrappedHandler);
    }
  • Entry in the central toolRegistrations array that triggers registration of get_sim_app_path_name_proj when registerTools(server) is called, conditional on environment variable.
    {
      register: registerGetSimulatorAppPathByNameProjectTool,
      groups: [
        ToolGroup.IOS_SIMULATOR_WORKFLOW,
        ToolGroup.APP_DEPLOYMENT,
        ToolGroup.PROJECT_DISCOVERY,
      ],
      envVar: 'XCODEBUILDMCP_TOOL_GET_SIMULATOR_APP_PATH_BY_NAME_PROJECT',
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the tool's function and required parameters but lacks details on what happens during execution (e.g., whether it builds the project, validates inputs, or returns errors), the output format (e.g., string path or structured data), or any side effects. The example helps but doesn't cover behavioral traits comprehensively.

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 appropriately sized with two sentences: one stating the purpose and one with usage guidance and an example. It's front-loaded with the core functionality and efficiently includes critical information. The example is helpful but could be slightly more concise by integrating it into the flow.

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

Completeness3/5

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

Given the complexity (6 parameters, no output schema, no annotations), the description is adequate but has gaps. It covers the purpose and required parameters well, but without annotations or output schema, it should ideally explain more about the return value (e.g., what the 'app bundle path' looks like) and potential errors. The example partially compensates, but completeness is moderate.

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 all parameters thoroughly. The description adds minimal value beyond the schema by emphasizing the four required parameters in the IMPORTANT note and providing an example with sample values. However, it doesn't explain parameter interactions or semantics beyond what's in the schema descriptions.

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: 'Gets the app bundle path for a simulator by name using a project file.' It specifies the verb ('gets'), resource ('app bundle path'), and key constraints ('by name', 'using a project file'). However, it doesn't explicitly differentiate from sibling tools like get_sim_app_path_id_proj or get_sim_app_path_name_ws, which appear to be similar tools using different identifiers or workspace files.

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 usage context by stating 'IMPORTANT: Requires projectPath, scheme, platform, and simulatorName' and includes an example, which helps understand when to use it. However, it doesn't explicitly state when to choose this tool over alternatives (like get_sim_app_path_id_proj for simulator ID instead of name) or mention any prerequisites beyond the required parameters.

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