get_ui_tree
Retrieve the accessibility snapshot of a Windows window to inspect UI elements. Adjust depth and node limits to uncover content in native or Electron apps, and check truncated flag to adjust parameters.
Instructions
UI Automation tree of a window (roles, names, states) — the accessibility snapshot of a native Windows app. depth: default 4, max 30. max_nodes: default 200, max 1000 — max_nodes is the cost brake, NOT depth. Win32 apps expose content within 4-6 levels. Chromium/Electron apps (VS Code, Slack, Discord, Claude Desktop, Teams) bury real content under ~10 levels of Pane/Group wrappers: at low depth you get only empty Panes and conclude, wrongly, that the window is empty. Measured on Claude Desktop: depth=8 -> 15 useless nodes; depth=17 -> 115 nodes, 87 of them named (~8 KB) — the tree saturates at 17. So for Chromium/Electron ask for depth=15-20 and cap cost with max_nodes. The response reports depth, max_nodes, nodes, depth_reached and truncated; when truncated=true the tree was cut (read next_action) and you should repeat with a higher depth and/or max_nodes before concluding anything about the window. For finding a clickable target prefer ui_find (already filtered to interactive elements).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hwnd | No | Exact window handle | |
| depth | No | Max tree depth (default 4, max 30). 4-6 for native Win32; 15-20 for Chromium/Electron apps, whose content sits under ~10 wrapper levels. | |
| max_nodes | No | Max nodes returned (default 200, max 1000). This is the token-cost brake — raise depth freely and cap cost here. | |
| title_contains | No | Window title fragment |