Skip to main content

app_clear_data

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Delete an app's data and leave it installed — the state of a fresh install, without reinstalling. The app is stopped first. Android runs pm clear, which also revokes the runtime permissions the user granted; iOS simulators delete the app's preferences and empty its data container, and leave privacy grants and the keychain as they were. The answer says what was read back empty and what was kept. A real iPhone cannot clear in place: given the app's bundle as path, it uninstalls the app and installs it again, which empties its data container, read back, and resets its privacy permissions, which nothing outside the app can read. Without a path a phone refuses, and with one any other device does.

Changes the device, the app or the session: readOnlyHint is false.

Arguments​

NameTypeRequiredWhat it is
appstringyesPackage name on Android or bundle id on iOS.
contentstringThe bundle itself, base64, instead of a path: an .ipa, or a .app as a .tar.gz. Sent by the CLI and pipe when the daemon's disk is not the caller's.
devicestringDevice serial to target, e.g. "emulator-5554". Omit when only one device is running.
driverstring: uiautomator2, uiautomator, wdaDriver to use: "uiautomator2" (default for Android; fast, installs a server APK on first use), "uiautomator" (Android, installs nothing, slower, cannot type), or "wda" (WebDriverAgent: iOS simulators and iPhones).
namestringWith content: the file's name, such as "MobiumApp.app.tar.gz".
pathstringA real iPhone only: the app's own .app or .ipa, reinstalled as the reset. Its bundle id must be the app's.

Examples​

Each is the arguments of a tools/call request; the first is shown whole.

Delete an app's data, and keep it installed​

{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "app_clear_data",
"arguments": {
"app": "com.example.shop"
}
}
}