get_ui_tree
Retrieve the complete accessibility UI tree as structured JSON from iOS simulators for automation testing and interface analysis.
Instructions
Get the full accessibility/UI tree as structured JSON.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| udid | No | Simulator UDID (optional, defaults to booted simulator) |
Implementation Reference
- src/index.ts:615-625 (handler)The handler function for the 'get_ui_tree' MCP tool, which resolves the target device UDID and fetches the UI tree.
private async getUiTree(udid?: string) { const target = await resolveUdid(udid); try { const tree = await this.fetchUiTree(target); return { content: [{ type: 'text', text: JSON.stringify(tree, null, 2) }], }; } catch (error: any) { throw new McpError(ErrorCode.InternalError, `Failed to get UI tree: ${error.message}`); } }