Full detail for the two accessibility-tree tools. The README tools table has the summary. Both tools are macOS only; the Linux AT-SPI port is deferred (#102).
Accessibility tree of a native app's window (AXUIElement), read-only. owner only.
- Target. Default: the frontmost app's focused window.
app(bundle id or name) orpidselects an app.window(a title string) orall_windowsselects windows. Strict clients match windows by title only, so they cannot pick an untitled or duplicate-title window by index. A native JSON integer inwindowis still read as an index for existing callers (#145).include_menu_baralso walks the app's menu bar, so menu items get refs. - Per node. Role, subrole, title, value (secure fields always masked), state, frame in
display points (the
screenshot/mousespace, with display index), and arefvalid within thesnapshot_id. - Bounds.
max_depth20 (≤50),max_nodes300 (≤2000),timeout_ms3000 (≤10000) bound the whole call, every AX call included. Partial results are flaggedtruncated/timed_out, and elements that do not answer within 0.5 s are flaggedunresponsive. - Values. Long text values are read as a 200-character prefix.
- TCC. Needs Accessibility.
Acts on a ui_snapshot node by ref through the Accessibility API, without moving the pointer.
owner only (shell-class, like mouse and key).
- Arguments.
snapshot_id+ref+action. - Actions.
press(AXPress).set_value(AXValue, withvalue, advertised and passed as a string, e.g."3"or"true"; existing callers' native JSON number or bool are still accepted; replaces the whole value). A string the control refuses (AX error -25201) is retried once as the native number or boolean it spells (surrounding whitespace ignored, so" 3 "retries as 3), and only if that also refuses does the call fail with the value-type error. A refused write changes nothing.focus(sets AXFocused; never raises a window; refused where AXFocused is not settable).show_menu,confirm,cancel,increment,decrement.
- Unsupported actions. An action the element does not support is refused before anything is done, and the error lists the actions it does support.
activate. Does not activate the app or raise a window unlessactivate: true. With it, the tool sets AXFrontmost on the app, falls back to activating it, then raises the ref's window. If the app does not come to the front, the call fails and does nothing.show_menu, menu-bar items of a background app andfocusbeforekeytyping commonly need it.- Secure fields.
set_valuecan set a secure field over/mcpand a reverse attach. This daemon never logs or returns their value, and never logsvaluefor any target. Through--switchboard,set_valueon a secure field is refused by default, and nothing is typed into the app. See Serving a switchboard for the opt-in. - Audit exposure. Through a switchboard older than openab-sb 0.2.2,
ui_actionarguments, includingset_valuevalues, are written to the switchboard's audit log. 0.2.2 (openabdev/openab-sb#16) recordsvalueandkeytextonly as a redacted length. Do not send secrets throughset_valueover an older switchboard (keytyping has the same exposure). - Timeout.
timeout_ms2000 (≤10000) bounds the whole call: checks get at most 0.5 s each, and the action gets the rest. An action the app does not confirm in time is reported as unconfirmed. It may have happened, so re-snapshot and do not repeat it blindly. structuredContent. The target,activated, and, budget permitting,post_state(focused, and value for non-secure fields).- TCC. Needs Accessibility.
- The last 4 snapshots are kept for 5 minutes.
- A ref from a snapshot that is gone is refused as
stale ref. So is a ref whose element vanished, changed role or subrole, moved to another process, or left its window. - The tool never guesses a replacement. Take a new
ui_snapshotand use the new ref.
A ref under a window is accepted only while the element is still in a window it was walked
under: its AXWindow, or, for controls that report none (a save or confirm sheet's buttons), its
AXTopLevelUIElement or the nearest window, sheet, drawer or popover up its AXParent chain,
must be one recorded on the ref's path. An element whose nearest container was never walked is
refused as stale ref … has left its window.