Get UI Hierarchy
get_ui_hierarchyCapture the UI element tree from a booted iOS simulator to inspect accessibility nodes and pixel bounds for automated testing.
Instructions
Capture the current UI element tree from a booted simulator. Works standalone (auto-targets the sole booted device) or within a recording session via sessionId. Returns a normalized accessibility tree with pixel bounds for point-based taps when selectors don't match. Use interactiveOnly to filter to tappable elements.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| compact | No | If true, collapse single-child chains and strip anonymous containers to reduce tree depth. | |
| sessionId | No | Active session ID. If omitted, auto-targets the sole booted simulator. | |
| artifactPath | No | If set, write the full hierarchy JSON to this file path and return only a summary with node count. | |
| interactiveOnly | No | If true, return only elements with id, label, or text — stripping non-interactive nodes. | |
| includeRawOutput | No | If true, include the raw CLI/daemon output string in the response (default: omitted to save context). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hierarchy | Yes | Normalized UI element tree | |
| nodeCount | No | Total number of nodes in the hierarchy tree. | |
| rawOutput | No | Raw output from the automation backend (CSV from daemon, JSON from CLI). Only included when includeRawOutput is true. | |
| diagnostics | No | Diagnostic warnings when the result may be incomplete (e.g., empty parsed tree with non-empty raw output). | |
| artifactPath | No | Path where the full hierarchy was written, if artifactPath was specified. |