kill_app
Terminate a running app on a mobile device by providing its bundle ID or package name.
Instructions
Ferme une app sur le device actif.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bundle_id | Yes | Bundle ID (iOS) ou package name (Android) |
Implementation Reference
- src/tools/app.ts:37-60 (handler)Main tool handler for 'kill_app' - resolves the active device, then dispatches to iOS or Android platform-specific kill function. Registered as an MCP tool with Zod schema expecting 'bundle_id' string parameter.
export function registerKillApp(server: McpServer): void { server.tool( "kill_app", "Ferme une app sur le device actif.", { bundle_id: z.string().describe("Bundle ID (iOS) ou package name (Android)"), }, async ({ bundle_id }) => { const killResult = await resolveDevice(); if ("error" in killResult) return { content: [{ type: "text", text: killResult.error }], isError: true }; const dev = killResult.device; try { if (dev.platform === "ios") await iosKillApp(dev.id, bundle_id); else await androidKillApp(bundle_id); logAction("kill_app", `App fermée : ${bundle_id}`, false, dev.platform, dev.id, dev.name); return { content: [{ type: "text", text: `App fermée : ${bundle_id}` }] }; } catch (err) { const msg = err instanceof Error ? err.message : String(err); return { content: [{ type: "text", text: `Erreur kill_app: ${msg}` }], isError: true }; } } ); - src/tools/multi-device.ts:93-98 (handler)Multi-device handler for 'kill_app' action - iterates over specified devices and calls platform-specific kill function for each.
case "kill_app": { if (dev.platform === "ios") await iosKillApp(dev.id, bundle_id!); else await androidKillApp(bundle_id!); content.push({ type: "text", text: `${header} — ${bundle_id} ferme\n` }); break; } - src/platforms/ios/simctl.ts:158-162 (helper)iOS implementation - terminates an app on a simulator using `xcrun simctl terminate <udid> <bundleId>`.
export async function iosKillApp(deviceUdid: string, bundleId: string): Promise<void> { validateUdid(deviceUdid); validateBundleId(bundleId); await simctl(["terminate", deviceUdid, bundleId]); } - src/platforms/android/adb.ts:346-349 (helper)Android implementation - force-stops an app using `adb shell am force-stop <packageName>`.
export async function androidKillApp(packageName: string): Promise<void> { validatePackageName(packageName); await adb(["shell", "am", "force-stop", packageName]); } - src/index.ts:64-64 (registration)Registration of the kill_app tool via registerKillApp(server) on the MCP server. The function is imported from ./tools/app.js at line 14.
registerKillApp(server);