Skip to content

Device Inspection

Inspect the live state of a running app — UI hierarchy, network traffic, recomposition counts, proxy settings, and feature flags — without touching the source code.


Dump the current UI accessibility hierarchy from the connected device.

What to ask your AI:

  • “show me the UI tree”
  • “dump the view hierarchy”
  • “find all clickable elements on screen”

Parameters

NameTypeRequiredDefaultDescription
device_idstringNoauto-selectADB device serial
filter_resource_idstringNoOnly include nodes whose resource ID contains this substring
filter_textstringNoOnly include nodes whose visible text contains this substring
filter_classstringNoOnly include nodes whose class name contains this substring
max_depthintNoTruncate the tree at this depth level
compose_onlyboolNofalseWhen true, exclude native View nodes and return only Compose semantics nodes
formatenumNotreeOutput format: tree (indented), flat (one node per line), summary (counts only), or json

Tips

  • Use compose_only: true to cut through Android system UI noise when debugging a pure Compose screen.
  • format: summary gives a quick node count without flooding the context window — useful for a sanity check before requesting the full tree.
  • Combine filter_text with format: flat to locate a specific button or label instantly.

Capture HTTP traffic emitted by the app via logcat for a given duration.

What to ask your AI:

  • “show network traffic for the last 10 seconds”
  • “what API calls happened during login?”
  • “capture HTTP requests while I scroll the feed”

Parameters

NameTypeRequiredDefaultDescription
duration_secondsintNo10How long to listen to logcat (seconds)
packagestringNoFilter to a specific app package; omit to capture all packages
device_idstringNoauto-selectADB device serial

Tips

  • Logcat-based capture requires the app to log HTTP traffic (e.g. via OkHttp logging interceptor). Use cp_inspect_network_logs (Embedded Compose page) for in-process capture without a logging interceptor.
  • Keep duration_seconds short (5–10 s) and trigger the action you want to observe immediately after calling this tool.

Analyse Compose recomposition activity to surface hot composables and unnecessary re-renders.

What to ask your AI:

  • “why is this screen slow?”
  • “check for unnecessary recompositions”
  • “show recomposition counts while I scroll”

Parameters

NameTypeRequiredDefaultDescription
project_pathstringNoPath to the target project (used to locate compiler metrics)
modeenumNoautoOne of: compiler_metrics (build-time stability report), logcat (runtime counts), perfetto (trace), auto (picks best available)
packagestringNoApp package to filter logcat output
device_idstringNoauto-selectADB device serial
modulestringNoGradle module for compiler_metrics mode
duration_secondsintNo10Duration for logcat and perfetto modes

Tips

  • mode: auto first checks for Compose compiler metrics in the build output; if absent it falls back to logcat.
  • mode: compiler_metrics requires a build with -Pcomposeproof.compilerMetrics=true or the equivalent Compose compiler flag freeCompilerArgs += ["-P", "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=..."].
  • High skip counts are good; high restart counts on leaf composables usually indicate a stability problem — follow up with cp_analyze_stability.

Get, set, or clear the HTTP proxy on the device — useful for routing traffic through Charles Proxy, mitmproxy, or Proxyman.

What to ask your AI:

  • “set up Charles Proxy on the device”
  • “what proxy is currently configured?”
  • “clear the proxy setting”

Parameters

NameTypeRequiredDefaultDescription
actionenumNogetOne of: set, get, clear
hoststringNo (Yes for set)Proxy host (e.g. 192.168.1.5)
portintNo (Yes for set)Proxy port (e.g. 8888)
device_idstringNoauto-selectADB device serial

Tips

  • After setting a proxy, remember to clear it when done — a stale proxy setting will break all network requests if your proxy tool is no longer running.
  • For HTTPS inspection you still need to install the proxy’s root certificate on the device separately (Settings → Security → Install CA certificate).

List, read, or write SharedPreferences entries on the device — handy for toggling feature flags without rebuilding.

What to ask your AI:

  • “what SharedPreferences files exist?”
  • “read the dark_mode flag”
  • “enable the new_checkout_flow flag”

Parameters

NameTypeRequiredDefaultDescription
actionenumNolist_filesOne of: list_files, read, write
packagestringYesApp package name (e.g. com.example.app)
prefs_namestringNo (Yes for read/write)SharedPreferences file name without .xml extension
keystringNo (Yes for write)Preference key to read or write
valuestringNo (Yes for write)Value to write (cast to the existing type automatically)
device_idstringNoauto-selectADB device serial

Tips

  • Start with action: list_files to discover which preference files exist before attempting a read.
  • Changes take effect immediately if the app reads preferences dynamically; some flags require an app restart.
  • For DataStore preferences use cp_inspect_datastore (Embedded Runtime page) instead.