Skip to main content

app_logs

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

Read a log: the current WebView's console, or the device's own log (logcat on Android, the unified log on an iOS simulator, and on a real iPhone what the session has captured since it started — a phone keeps no history). With no source it follows the context — the page's console in a WebView, the device log on the native shell. Each read reports what arrived since the last one, so "nothing was logged during this step" is assertable. The console includes uncaught errors and unhandled promise rejections, and capture starts when the context is entered. The device log's first read returns the most recent lines, since there is no earlier read to continue from; a read narrowed by app or level leaves the rest unread. For why an app died, app_crashes is the record that survives — the log is a ring that noise overruns.

Read-only: readOnlyHint is true.

Arguments​

NameTypeRequiredWhat it is
appstringDevice log only: keep one app's lines, by package or bundle id. Filtered by app rather than process, so a crash and the restart after it are both kept. The system's own lines about the app are kept too — system_server's on Android ("ANR in "), runningboardd's on iOS ("termination reported by launchd") — since those say it died or hung.
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).
levelstring: log, verbose, debug, info, warn, error, fatalOnly entries at exactly this level. Omit for all. A console uses log/info/warn/error/debug; the device log verbose/debug/info/warn/error/fatal.
linesintegerDevice log only: the most recent lines to return, at most. Default 100.
sourcestring: webview, deviceWhich log. Omit to follow the context.

Examples​

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

Read one app's errors from the device log​

{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "app_logs",
"arguments": {
"source": "device",
"app": "com.example.shop",
"level": "error"
}
}
}