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';

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

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