launch_app
Launch a mobile app on an active device using its bundle ID (iOS) or package name (Android).
Instructions
Lance une app sur le device actif. iOS : bundle ID (ex: com.monapp.ios). Android : package name (ex: com.monapp.android).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bundle_id | Yes | Bundle ID (iOS) ou package name (Android) |
Implementation Reference
- src/tools/app.ts:8-35 (handler)Main handler for the 'launch_app' tool. Registers the tool with an MCP server, accepts a 'bundle_id' parameter, resolves the active device, then calls the platform-specific launch function (iosLaunchApp or androidLaunchApp). Returns success/error messages.
export function registerLaunchApp(server: McpServer): void { server.tool( "launch_app", "Lance une app sur le device actif. iOS : bundle ID (ex: com.monapp.ios). Android : package name (ex: com.monapp.android).", { bundle_id: z.string().describe("Bundle ID (iOS) ou package name (Android)"), }, async ({ bundle_id }) => { const result = await resolveDevice(); if ("error" in result) return { content: [{ type: "text", text: result.error }], isError: true }; const dev = result.device; try { if (dev.platform === "ios") await iosLaunchApp(dev.id, bundle_id); else await androidLaunchApp(bundle_id); const platform = dev.platform === "ios" ? "🍎" : "🤖"; const successMsg = `${platform} App lancée : ${bundle_id} sur ${dev.name}`; logAction("launch_app", successMsg, false, dev.platform, dev.id, dev.name); return { content: [{ type: "text", text: successMsg }] }; } catch (err) { const msg = err instanceof Error ? err.message : String(err); logAction("launch_app", `Erreur: ${msg}`, true, dev.platform, dev.id, dev.name); return { content: [{ type: "text", text: `Erreur launch_app: ${msg}` }], isError: true }; } } ); } - src/tools/app.ts:12-14 (schema)Input schema for the launch_app tool. Defines 'bundle_id' as a required string parameter for bundle ID (iOS) or package name (Android).
{ bundle_id: z.string().describe("Bundle ID (iOS) ou package name (Android)"), }, - src/index.ts:14-14 (registration)Import of the registerLaunchApp function from the tools/app module.
import { registerLaunchApp, registerKillApp } from "./tools/app.js"; - src/index.ts:63-63 (registration)Registration of the launch_app tool with the MCP server instance.
registerLaunchApp(server); - src/platforms/ios/simctl.ts:149-153 (helper)iOS implementation of app launch. Validates UDID and bundle ID, then executes 'xcrun simctl launch <udid> <bundleId>'.
export async function iosLaunchApp(deviceUdid: string, bundleId: string): Promise<void> { validateUdid(deviceUdid); validateBundleId(bundleId); await simctl(["launch", deviceUdid, bundleId]); } - src/platforms/android/adb.ts:341-344 (helper)Android implementation of app launch. Validates package name, then executes 'adb shell monkey -p <package> -c android.intent.category.LAUNCHER 1'.
export async function androidLaunchApp(packageName: string): Promise<void> { validatePackageName(packageName); await adb(["shell", "monkey", "-p", packageName, "-c", "android.intent.category.LAUNCHER", "1"]); } - src/utils/auto-report.ts:65-65 (helper)Marks 'launch_app' as a tool that always gets a screenshot in auto-reporting.
const ALWAYS_SCREENSHOT_TOOLS = new Set(["assert_visible", "assert_not_visible", "accessibility_audit", "launch_app"]);