Skip to main content
Glama

get_ios_bundle_id

Extract the bundle identifier from an iOS app bundle (.app) by providing the app path to identify the application's unique ID for development and testing purposes.

Instructions

Extracts the bundle identifier from an iOS app bundle (.app). IMPORTANT: You MUST provide the appPath parameter. Example: get_ios_bundle_id({ appPath: '/path/to/your/app.app' }) Note: In some environments, this tool may be prefixed as mcp0_get_ios_bundle_id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appPathYesPath to the iOS .app bundle to extract bundle ID from (full path to the .app directory)

Implementation Reference

  • The async handler function for the 'get_ios_bundle_id' tool. Validates the appPath, checks if the file exists, extracts the bundle ID using 'defaults read' or 'PlistBuddy' from Info.plist, logs the result, and returns a formatted response with the bundle ID and next steps.
        async (params): Promise<ToolResponse> => {
          const appPathValidation = validateRequiredParam('appPath', params.appPath);
          if (!appPathValidation.isValid) {
            return appPathValidation.errorResponse!;
          }
    
          const appPathExistsValidation = validateFileExists(params.appPath);
          if (!appPathExistsValidation.isValid) {
            return appPathExistsValidation.errorResponse!;
          }
    
          log('info', `Starting bundle ID extraction for iOS app: ${params.appPath}`);
    
          try {
            let bundleId;
    
            try {
              bundleId = execSync(`defaults read "${params.appPath}/Info" CFBundleIdentifier`)
                .toString()
                .trim();
            } catch {
              try {
                bundleId = execSync(
                  `/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "${params.appPath}/Info.plist"`,
                )
                  .toString()
                  .trim();
              } catch (innerError: unknown) {
                throw new Error(
                  `Could not extract bundle ID from Info.plist: ${innerError instanceof Error ? innerError.message : String(innerError)}`,
                );
              }
            }
    
            log('info', `Extracted iOS bundle ID: ${bundleId}`);
    
            return {
              content: [
                {
                  type: 'text',
                  text: ` Bundle ID for iOS app: ${bundleId}`,
                },
                {
                  type: 'text',
                  text: `Next Steps:
    - Launch in simulator: launch_app_in_simulator({ simulatorUuid: "YOUR_SIMULATOR_UUID", bundleId: "${bundleId}" })`,
                },
              ],
            };
          } catch (error) {
            const errorMessage = error instanceof Error ? error.message : String(error);
            log('error', `Error extracting iOS bundle ID: ${errorMessage}`);
    
            return {
              content: [
                {
                  type: 'text',
                  text: `Error extracting iOS bundle ID: ${errorMessage}`,
                },
                {
                  type: 'text',
                  text: `Make sure the path points to a valid iOS app bundle (.app directory).`,
                },
              ],
            };
          }
        },
  • Zod schema for input parameters: requires 'appPath' as a string describing the path to the iOS .app bundle.
    {
      appPath: z
        .string()
        .describe(
          'Path to the iOS .app bundle to extract bundle ID from (full path to the .app directory)',
        ),
    },
  • The registerGetiOSBundleIdTool function that registers the 'get_ios_bundle_id' tool on the MCP server, including name, description, schema, and handler.
    export function registerGetiOSBundleIdTool(server: McpServer): void {
      server.tool(
        'get_ios_bundle_id',
        "Extracts the bundle identifier from an iOS app bundle (.app). IMPORTANT: You MUST provide the appPath parameter. Example: get_ios_bundle_id({ appPath: '/path/to/your/app.app' }) Note: In some environments, this tool may be prefixed as mcp0_get_ios_bundle_id.",
        {
          appPath: z
            .string()
            .describe(
              'Path to the iOS .app bundle to extract bundle ID from (full path to the .app directory)',
            ),
        },
        async (params): Promise<ToolResponse> => {
          const appPathValidation = validateRequiredParam('appPath', params.appPath);
          if (!appPathValidation.isValid) {
            return appPathValidation.errorResponse!;
          }
    
          const appPathExistsValidation = validateFileExists(params.appPath);
          if (!appPathExistsValidation.isValid) {
            return appPathExistsValidation.errorResponse!;
          }
    
          log('info', `Starting bundle ID extraction for iOS app: ${params.appPath}`);
    
          try {
            let bundleId;
    
            try {
              bundleId = execSync(`defaults read "${params.appPath}/Info" CFBundleIdentifier`)
                .toString()
                .trim();
            } catch {
              try {
                bundleId = execSync(
                  `/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "${params.appPath}/Info.plist"`,
                )
                  .toString()
                  .trim();
              } catch (innerError: unknown) {
                throw new Error(
                  `Could not extract bundle ID from Info.plist: ${innerError instanceof Error ? innerError.message : String(innerError)}`,
                );
              }
            }
    
            log('info', `Extracted iOS bundle ID: ${bundleId}`);
    
            return {
              content: [
                {
                  type: 'text',
                  text: ` Bundle ID for iOS app: ${bundleId}`,
                },
                {
                  type: 'text',
                  text: `Next Steps:
    - Launch in simulator: launch_app_in_simulator({ simulatorUuid: "YOUR_SIMULATOR_UUID", bundleId: "${bundleId}" })`,
                },
              ],
            };
          } catch (error) {
            const errorMessage = error instanceof Error ? error.message : String(error);
            log('error', `Error extracting iOS bundle ID: ${errorMessage}`);
    
            return {
              content: [
                {
                  type: 'text',
                  text: `Error extracting iOS bundle ID: ${errorMessage}`,
                },
                {
                  type: 'text',
                  text: `Make sure the path points to a valid iOS app bundle (.app directory).`,
                },
              ],
            };
          }
        },
      );
    }
  • Entry in the toolRegistrations array that conditionally registers the get_ios_bundle_id tool based on environment variable, assigning it to relevant tool groups.
    register: registerGetiOSBundleIdTool,
    groups: [
      ToolGroup.IOS_SIMULATOR_WORKFLOW,
      ToolGroup.IOS_DEVICE_WORKFLOW,
      ToolGroup.APP_DEPLOYMENT,
      ToolGroup.PROJECT_DISCOVERY,
    ],
    envVar: 'XCODEBUILDMCP_TOOL_GET_IOS_BUNDLE_ID',
Behavior3/5

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

With no annotations, the description carries full burden. It clarifies the tool extracts (read-only) data, mentions the mandatory 'appPath' parameter, and notes potential environment-specific prefixing, adding useful context. However, it doesn't detail error conditions, output format, or file access permissions.

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 three sentences: purpose, mandatory parameter note with example, and environment note. It's front-loaded with the core function, though the example could be more concise. No wasted sentences.

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 no annotations and no output schema, the description is moderately complete for a simple extraction tool. It covers purpose and parameter usage but lacks details on return values, error handling, or dependencies. More behavioral context would improve completeness.

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

Parameters4/5

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

Schema description coverage is 100%, so the schema fully documents the single parameter. The description adds minimal value by emphasizing the parameter's necessity and providing an example, but doesn't explain semantics beyond what the schema states. With 0 parameters, baseline is 4, but here it's 4 due to the example adding slight clarity.

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

Purpose5/5

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

The description clearly states the specific action ('Extracts') and target resource ('bundle identifier from an iOS app bundle (.app)'), distinguishing it from sibling tools like 'get_mac_bundle_id' which targets macOS. The purpose is precise and unambiguous.

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 implies usage when an iOS bundle ID is needed from a .app file, but lacks explicit guidance on when to use this versus alternatives (e.g., 'get_mac_bundle_id' for macOS). It provides a mandatory parameter note but no broader context or exclusions.

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