simulator_find
The MCP tool that lists every element on the Team's Simulator's screen that matches a selector, best first, without touching anything.
simulator_find returns every usable element on the Team’s running Simulator’s screen that matches a selector, best first, plus the elements that matched but were left out and why (hidden, off-screen). It touches nothing and does not wait: an element that is not there yet gives an empty list. It is read-only. Use it to check what a selector will hit before simulator_tap acts on it.
| Read-only | Destructive | Idempotent |
|---|---|---|
| Yes | No | Yes |
Selectors
The element tools (simulator_tap, simulator_find, simulator_wait, simulator_slider, simulator_adjust, and the steps of simulator_batch) name an element with a selector instead of coordinates. The element is looked up in the accessibility tree that simulator_describe_ui shows, on a fresh read each time, so it is found wherever the layout puts it. Content that is not in the accessibility tree cannot be selected; use coordinates for it.
| Field | Type | What it matches |
|---|---|---|
text |
string | The element’s visible text: its label (or title) or its value. Case-insensitive, spaces at the ends ignored, and a part of the text is enough unless exact is set |
id |
string | The element’s accessibilityIdentifier, exactly |
value |
string | The element’s value only, e.g. a field’s text. Case-insensitive; part of it is enough unless exact is set |
role |
string | The accessibility role, exactly, e.g. AXButton, AXSlider, AXSwitch |
nodeId |
string | A nodeId from simulator_describe_ui or this tool: exactly that element and nothing else |
exact |
boolean | text and value must equal the element’s text, not just appear in it |
strict |
boolean | Fail when several usable elements match, instead of taking the best one |
Give at least one of text, id, value, role and nodeId; empty strings count as not given. Every field given must match.
Ranking. When several elements match, the best comes first: text equal to the query beats text containing it; a match on the label beats a match on the value; a button, link, field, switch or cell beats static text with the same words; then the smaller element; then top to bottom and left to right. Tools that act on one element take the first, and report matchCount: more than 1 means the ranking decided. Add id, role, exact or strict to make sure.
Left out. Elements that match but cannot be used are listed under excluded with a reason: hidden, empty-frame (no size), off-screen (its center is outside the screen), and for taps disabled.
nodeId. A nodeId names one element of the app as it runs now. It stops working when the element goes away, is hidden, moves off-screen, or the app restarts: read the tree again then. Treat it as opaque and do not keep it for later.
Selector errors (any element tool):
| Message | When | What to do |
|---|---|---|
| Name the element: text, id, value, role or nodeId. | No selector field was given | Add one |
| invalid nodeId; use the opaque string returned by describe-ui | nodeId is not one the tools gave out |
Copy it unchanged from simulator_describe_ui |
| node_id_device_mismatch: nodeId belongs to a different device | The nodeId is from another Simulator |
Read the tree of this device |
| stale_node: nodeId is absent, hidden, disabled, off-screen, or no longer matches; describe UI again | The element is gone or changed | Call simulator_describe_ui again |
| ambiguous selector selector: n usable matches; add an id, role, or value filter | strict (or a nodeId) and several elements match |
Narrow the selector |
| no usable element matching selector within ns | A tool that waits found nothing usable in time; (matched but skipped: 1 hidden, …) follows when some matched but could not be used |
Check with simulator_find, scroll with simulator_scroll_to, or wait longer |
Inputs
| Input | Type | Required | Default | What it does |
|---|---|---|---|---|
teamId |
string (UUID) | Yes | — | The Team, from list_teams |
simulator |
string | No | The Team’s default device | Which device, by id from list_simulators |
text, id, value, role, nodeId, exact, strict |
see Selectors | At least one of the first five | — | The selector |
Result
| Field | What |
|---|---|
ok |
true |
matches |
The usable elements, best first; empty when none |
matches[].element |
The element: label, value, identifier, nodeId, role, frame (x, y, width, height), enabled, interactive (takes input), hidden, and on some controls activationPoint, sliderTrack, adjustable, adjustmentActions |
matches[].point |
x, y: where a tap on it lands, in screen coordinates |
matches[].exact |
Whether its text equals the query (always true for an id) |
excluded |
Elements that matched but cannot be used |
excluded[].element |
The element, as above |
excluded[].reason |
hidden, empty-frame, off-screen or disabled |
{
"ok": true,
"matches": [
{ "element": { "label": "New note", "identifier": "new-note", "nodeId": "ax1:…", "role": "AXButton",
"frame": { "x": 16, "y": 120, "width": 370, "height": 52 }, "enabled": true, "interactive": true, "adjustable": false },
"point": { "x": 201, "y": 146 }, "exact": true }
],
"excluded": []
}Errors
The selector errors above, plus the errors every Simulator tool can return: see start_simulator.
Example
{"name": "simulator_find", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "text": "New note"}}