Skip to Content
ReferenceToolsui_snapshot

ui_snapshot

The accessibility tree of a window as text, each element with an id that ui_act and the pointer tools accept. Prefer it to a screenshot where the app exposes one: it is cheaper and does not depend on pixels. Some apps expose little or nothing (then use screen_capture); the answer says when a limit cut the tree.

Arguments

Over MCP every tool also takes machine: the machine’s name or id, optional when only one machine is online.

NameTypeRequiredMeaning
depthintegernoTree depth (default 12).
max_elementsintegernoAt most this many elements (default 400, at most 3000).
windowintegernoWindow id from window_list (default: the frontmost window).

Result

NameTypeRequiredMeaning
elementsintegeryes
snapshotstringyesValid until the next snapshot; element ids belong to it.
textstringyesThe tree as indented text, one element per line: [id] role "name" value (state).
truncatedstringnodepth, max_elements or time when a limit cut the tree; absent when complete.
windowintegerno

Examples

{ "name": "ui_snapshot", "arguments": { "machine": "<machine>" } }

Limits

The call times out after 30 s (timed_out). Available since version 0.0.2. A refused or failed call returns one of the error codes.