Skip to main content
Glama

get_app_bundle_id

Extract the bundle identifier from an app bundle (.app) for Apple platforms like iOS, iPadOS, watchOS, tvOS, or visionOS by specifying the app path.

Instructions

Extracts the bundle identifier from an app bundle (.app) for any Apple platform (iOS, iPadOS, watchOS, tvOS, visionOS). IMPORTANT: You MUST provide the appPath parameter. Example: get_app_bundle_id({ appPath: '/path/to/your/app.app' })

Input Schema

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

Implementation Reference

  • The core handler function that implements the tool logic: validates app path, checks existence, extracts CFBundleIdentifier from Info or Info.plist using defaults read or PlistBuddy, returns success/error response with next steps.
    export async function get_app_bundle_idLogic(
      params: GetAppBundleIdParams,
      executor: CommandExecutor,
      fileSystemExecutor: FileSystemExecutor,
    ): Promise<ToolResponse> {
      // Zod validation is handled by createTypedTool, so params.appPath is guaranteed to be a string
      const appPath = params.appPath;
    
      if (!fileSystemExecutor.existsSync(appPath)) {
        return {
          content: [
            {
              type: 'text',
              text: `File not found: '${appPath}'. Please check the path and try again.`,
            },
          ],
          isError: true,
        };
      }
    
      log('info', `Starting bundle ID extraction for app: ${appPath}`);
    
      try {
        let bundleId;
    
        try {
          bundleId = await executeSyncCommand(
            `defaults read "${appPath}/Info" CFBundleIdentifier`,
            executor,
          );
        } catch {
          try {
            bundleId = await executeSyncCommand(
              `/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "${appPath}/Info.plist"`,
              executor,
            );
          } catch (innerError) {
            throw new Error(
              `Could not extract bundle ID from Info.plist: ${innerError instanceof Error ? innerError.message : String(innerError)}`,
            );
          }
        }
    
        log('info', `Extracted app bundle ID: ${bundleId}`);
    
        return {
          content: [
            {
              type: 'text',
              text: `✅ Bundle ID: ${bundleId}`,
            },
            {
              type: 'text',
              text: `Next Steps:
    - Simulator: install_app_sim + launch_app_sim
    - Device: install_app_device + launch_app_device`,
            },
          ],
          isError: false,
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log('error', `Error extracting app bundle ID: ${errorMessage}`);
    
        return {
          content: [
            {
              type: 'text',
              text: `Error extracting app bundle ID: ${errorMessage}`,
            },
            {
              type: 'text',
              text: `Make sure the path points to a valid app bundle (.app directory).`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema for input validation defining 'appPath' parameter and inferred TypeScript type.
    const getAppBundleIdSchema = z.object({
      appPath: z
        .string()
        .describe(
          'Path to the .app bundle to extract bundle ID from (full path to the .app directory)',
        ),
    });
    
    // Use z.infer for type safety
    type GetAppBundleIdParams = z.infer<typeof getAppBundleIdSchema>;
  • Default export registering the tool with name, description, schema (MCP compatible), and typed handler wrapping the logic function.
    export default {
      name: 'get_app_bundle_id',
      description:
        "Extracts the bundle identifier from an app bundle (.app) for any Apple platform (iOS, iPadOS, watchOS, tvOS, visionOS). IMPORTANT: You MUST provide the appPath parameter. Example: get_app_bundle_id({ appPath: '/path/to/your/app.app' })",
      schema: getAppBundleIdSchema.shape, // MCP SDK compatibility
      handler: createTypedTool(
        getAppBundleIdSchema,
        (params: GetAppBundleIdParams) =>
          get_app_bundle_idLogic(params, getDefaultCommandExecutor(), getDefaultFileSystemExecutor()),
        getDefaultCommandExecutor,
      ),
    };
  • Utility function to run shell commands synchronously via the CommandExecutor, throwing on failure.
    async function executeSyncCommand(command: string, executor: CommandExecutor): Promise<string> {
      const result = await executor(['/bin/sh', '-c', command], 'Bundle ID Extraction');
      if (!result.success) {
        throw new Error(result.error ?? 'Command failed');
      }
      return result.output || '';
    }
  • Re-export of the main tool for device workflow context.
    // Re-export from project-discovery to complete workflow
    export { default } from '../project-discovery/get_app_bundle_id.ts';
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the tool's behavior as an extraction operation and specifies platform compatibility, but does not mention potential errors (e.g., invalid paths), permissions needed, or output format. It adds some context but leaves behavioral gaps for a tool with no annotation coverage.

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 note and an example. It is appropriately sized with two sentences, though the example could be integrated more seamlessly. Every sentence earns its place by adding clarity or guidance.

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 tool's low complexity (single parameter, no output schema, no annotations), the description is adequate but incomplete. It covers the purpose and parameter requirement well, but lacks details on output format, error handling, or platform-specific nuances, which would be helpful for full contextual understanding.

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 'appPath'. The description adds value by emphasizing the parameter's importance ('You MUST provide the appPath parameter') and providing an example, but does not add semantic meaning beyond what the schema already states. With 0 parameters beyond the single documented one, baseline is 4.

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 explicitly states the verb ('Extracts') and resource ('bundle identifier from an app bundle'), specifies the scope ('for any Apple platform'), and distinguishes from sibling tools like 'get_mac_bundle_id' by being platform-agnostic. It provides a clear, specific purpose that differentiates it from related tools.

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 needing to extract a bundle ID from an app bundle, but does not explicitly state when to use this tool versus alternatives like 'get_mac_bundle_id' or other sibling tools. It provides some context (platform scope) but lacks explicit guidance on when to choose this tool over others.

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

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/getsentry/XcodeBuildMCP'

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