Skip to main content
Glama
XC-MCP: XCode CLI wrapper

XC-MCP: XCode CLI wrapper

by conorluddy

Find UI Element

idb-ui-find-element
Read-onlyIdempotent

Find UI elements by semantic search of the iOS accessibility tree using labels or identifiers, returning tap-ready coordinates without screenshots.

Instructions

idb-ui-find-element

Find UI elements by semantic search in accessibility tree - no screenshots needed.

Overview

Queries the accessibility tree and searches for elements matching a label or identifier. Returns matching elements with tap-ready coordinates (centerX, centerY), enabling agents to find specific UI controls without visual analysis. Fast semantic search replaces screenshot-based visual scanning for complex UIs.

Parameters

Required

  • query (string): Search term to match against element labels or identifiers

Optional

  • exact (boolean): Exact matching instead of substring matching

  • elementType (string): Filter by accessibility type; can be used without query

  • identifier (string): Exact identifier filter; can be used without query

  • index (integer): Zero-based selection returned as selectedElement

  • udid (string): Target identifier - auto-detects if omitted

Returns

Array of matching elements with:

  • Type, label, identifier

  • Tap-ready coordinates (centerX, centerY)

  • Full frame boundaries (x, y, width, height)

Returns empty array if no matches found.

Examples

Find login button

const result = await idbUiFindElementTool({
  query: 'login'
});

Find email field on specific device

const emailField = await idbUiFindElementTool({
  query: 'email',
  udid: 'DEVICE-UDID'
});

Find by identifier partial match

const search = await idbUiFindElementTool({
  query: 'submit'
});

How It Works

  1. Query accessibility tree: Calls idb ui describe-all (~80ms)

  2. Filter by query: Searches element labels and identifiers (case-insensitive partial match)

  3. Return coordinates: Provides tap-ready centerX/centerY for direct use with idb-ui-tap

  • accessibility-quality-check: Quick assessment of accessibility data richness

  • idb-ui-describe: Full accessibility tree with all element details

  • idb-ui-tap: Tap elements using coordinates

  • screenshot: Visual fallback if accessibility insufficient

Notes

  • Uses case-insensitive partial matching ("log" matches "Login")

  • Returns all matching elements (filter in agent logic if needed)

  • Only returns elements with valid frame coordinates

  • Much faster than visual analysis (~80ms vs 2000ms for screenshot)

  • 5-6x cheaper token cost (~40 tokens vs ~170 for screenshot)

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "idb-ui-find-element"
  }
}

Input Schema

NameRequiredDescriptionDefault
udidNo
exactNo
indexNo
queryNo
identifierNo
elementTypeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv5.0.0
    • addedInput schema / properties / elementType
      Added value: +{
      +  "type": "string"
      +}
    • addedInput schema / properties / exact
      Added value: +{
      +  "type": "boolean"
      +}
    • addedInput schema / properties / identifier
      Added value: +{
      +  "type": "string"
      +}
    • addedInput schema / properties / index
      Added value: +{
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "query"
      -]
  2. Addedv1.1.0

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and closed-world scope, so the safety profile is covered. The description adds genuine behavior beyond that: case-insensitive partial matching, only elements with valid frame coordinates are returned, an empty array on no match, and the ~80ms underlying `idb ui describe-all` call. Missing only failure behavior (e.g., no booted device, accessibility tree unavailable), which keeps it short of the top score.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured and front-loaded, but padded for a six-parameter search tool: the speed claim (~80ms vs 2000ms) and token-cost claim appear both in Overview and Notes, and the three examples add little beyond the first. Sections earn their place individually, yet the whole could be roughly halved.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, and the description fully specifies the return value — array of matches with type, label, identifier, centerX/centerY, and frame — plus the empty-array case. Combined with the parameter documentation and sibling routing, an agent has everything needed to call and consume results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must carry all six parameters, and it does: query, exact, elementType, identifier, index (zero-based, reflected as selectedElement), and udid (auto-detected if omitted). The one flaw is the 'Required' heading over query, which conflicts with the schema's empty required list and is only implicitly corrected by the note that elementType and identifier can be used without query.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (find UI elements by semantic search over the accessibility tree) and immediately separates itself from sibling approaches by noting no screenshots are needed. The agent can tell it apart from idb-ui-describe (full tree) and screenshot (visual) without opening schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The Related Tools section explicitly routes the agent: idb-ui-describe for the full tree, screenshot as a visual fallback, accessibility-quality-check to validate data richness, idb-ui-tap to act on results. It also states when the tool is preferable (complex UIs, speed and token cost) rather than leaving selection to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.