get_ui_tree
Reads a window's UI Automation tree as a compact, interactive-element list with paths, control types, names, IDs, and screen rects. Use it to inspect desktop app controls by window handle or title.
Instructions
Read the UI Automation tree of one window as a compact text list.
`window` is an hwnd from list_windows (e.g. "132456") or a unique part of a
title or process name (e.g. "notepad"). ambiguous matches are an error, not
a guess.
Returns one line per interactive element: path, control type, name,
automation id, screen rect. Invisible and zero-size elements are dropped.
max_depth defaults to 8 and the walk is breadth-first, because shallow
depth limits hide real controls (a calculator loses its keypad at depth 4,
Explorer hides the file list at depth 6). max_nodes caps the walk: dense
windows cost about 2.5 ms per node, so raise it deliberately.
include_text also lists static text elements, which is useful for reading
labels and status messages. include_containers adds List/Tree/Table/DataGrid
nodes: their paths are what inspect_element expects when you want to read a
whole table or list instead of numbering every row.
Read-only. If the window runs elevated while this server does not, Windows
blocks UIA and the tool reports that instead of returning an empty tree.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"window": "<window>"
},
"name": "get_ui_tree"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| window | Yes | ||
| max_depth | No | ||
| max_nodes | No | ||
| include_text | No | ||
| include_containers | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |