Skip to main content
Glama

launchApp

Automatically launch apps using their package ID on Android devices. Choose to clear app data or perform a cold boot for precise test scenarios.

Instructions

Launch an app by package name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appIdYesApp package ID of the app
clearAppDataNoWhether to clear app data before launching, default false
coldBootNoWhether to cold boot the app, default true

Implementation Reference

  • The registered handler function for the 'launchApp' MCP tool. It instantiates the LaunchApp class and calls its execute method with provided arguments.
    const launchAppHandler = async (device: BootedDevice, args: LaunchAppActionArgs) => { try { const launchApp = new LaunchApp(device); const result = await launchApp.execute( args.appId, args.clearAppData || false, args.coldBoot || true, undefined ); return createJSONToolResponse({ message: `Launched app ${args.appId}`, observation: result.observation, ...result }); } catch (error) { throw new ActionableError(`Failed to launch app: ${error}`); } };
  • Zod schema defining the input parameters for the launchApp tool.
    export const launchAppSchema = z.object({ appId: z.string().describe("App package ID of the app"), clearAppData: z.boolean().optional().describe("Whether to clear app data before launching, default false"), coldBoot: z.boolean().optional().describe("Whether to cold boot the app, default true"), });
  • Registration of the 'launchApp' tool with ToolRegistry, associating name, description, schema, and handler.
    ToolRegistry.registerDeviceAware( "launchApp", "Launch an app by package name", launchAppSchema, launchAppHandler );
  • TypeScript interface matching the launchApp schema for type safety in the handler.
    export interface LaunchAppActionArgs { appId: string; clearAppData?: boolean; coldBoot?: boolean; }
  • Core execute method in LaunchApp class that handles platform-specific app launching logic (delegates to iOS/Android implementations).
    async execute( packageName: string, clearAppData: boolean, coldBoot: boolean, activityName?: string ): Promise<LaunchAppResult> { logger.info("execute"); switch (this.device.platform) { case "ios": return this.executeiOS(packageName, clearAppData, coldBoot); case "android": return this.executeAndroid(packageName, clearAppData, coldBoot, activityName); default: throw new ActionableError(`Unsupported platform: ${this.device.platform}`); } }
  • TypeScript interface defining the structure of the launchApp result object.
    export interface LaunchAppResult { success: boolean; packageName: string; activityName?: string; observation?: ObserveResult; error?: string; }

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/zillow/auto-mobile'

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