ios_page_source
Get the UI hierarchy (page source) of an iOS device — THE single source of truth for element coordinates (physical screen points). Default format is "description": a compact list of visible named elements as Type: "label" @ (cx,cy) WxH, where (cx,cy) is the element CENTER and the exact tap point. Prefer acting on these labels via ios_tap_by_label rather than tapping raw coordinates. Elements with 0-width/height bounds (e.g. bottom-tab labels) are flagged [zero-area] — they cannot be tapped by coordinate; use ios_tap_by_label instead. FINDING THINGS IN LONG LISTS: pass search to grep the WHOLE hierarchy (including elements scrolled off-screen) — matches below the fold are flagged [off-screen]; bring them into view with ios_scroll_to_element, don't swipe blindly. To disambiguate duplicate labels, filter by type or use ios_find_element (strategy "accessibility id"). Use format "xml" to JUDGE FROM THE TREE instead of trusting a coordinate: with label it returns the COMPLETE SUBTREE of that element (a sign-in dialog is ~15 lines, where the whole tree is ~185k characters and will not fit in a response), and without it the tree comes back with anonymous layout containers pruned — nothing findable is ever hidden behind a pruned ancestor. Reach for the subtree whenever you need attributes the compact format omits: value, placeholderValue, focused, enabled. Requires an active iOS automation session (auto-starts if needed).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Filter (description format): only this element type, prefix optional e.g. "Button" or "XCUIElementTypeButton". | |
| udid | Yes | iOS device UDID | |
| label | No | Filter: only return elements matching this label/name | |
| format | No | Output format: "description" (default, compact readable summary) or "xml" (full hierarchy) | |
| search | No | Case-insensitive substring searched across the WHOLE hierarchy — type AND label — INCLUDING elements scrolled off-screen. Use this to locate an item in a long list (e.g. "Safari" in Settings) without swiping; off-screen hits are flagged [off-screen] so you can ios_scroll_to_element to them. Overrides visibleOnly. | |
| visibleOnly | No | Filter: exclude elements outside the current viewport (default: true; ignored when search is set) | |
| tappableOnly | No | Filter (description format): only interactive control types (Button, Cell, Link, TextField, Switch, Tab, etc). Default false. |