Skip to main content
Glama
conorluddy

XC-MCP: XCode CLI wrapper

by conorluddy

Find UI Element

idb-ui-find-element
Read-onlyIdempotent

Find UI elements by searching the accessibility tree for labels or identifiers, returning tap-ready coordinates for direct interaction.

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

  • 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)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
udidNo
queryYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations cover the safety profile (readOnly, idempotent, non-destructive), and the description enriches this with concrete behavior: case-insensitive partial matching, returning all matches, filtering out elements without valid frames, empty array on no match, and performance data (~80ms vs 2000ms for screenshots). No contradiction with annotations; these details add real decision value.

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-organized with clear headers and purpose front-loaded, but verbose: the three TypeScript examples are nearly identical (only the query string differs), and the how-it-works/notes sections repeat the same facts about case-insensitivity and ~80ms latency. Trimming redundant examples would tighten it without losing information.

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?

Despite lacking an output schema, the description explains the return shape (type, label, identifier, centerX/centerY, frame boundaries) and empty-array behavior. It covers parameters, examples, workflow, performance, and related tools — an agent has everything needed to call it correctly.

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

Parameters5/5

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

Schema coverage is 0%, so the description carries the full burden, and it delivers: query is explained as a search term matched case-insensitively against labels/identifiers, and udid as auto-detecting when omitted. Examples demonstrate realistic usage for each parameter, fully compensating for the empty schema.

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?

The opening line 'Find UI elements by semantic search in accessibility tree - no screenshots needed' states a specific verb, resource, and method. It distinguishes itself from siblings like idb-ui-describe (full tree) and screenshot (visual), making tool selection unambiguous.

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

Usage Guidelines4/5

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

The Related Tools section explicitly names alternatives and their purposes, including 'screenshot: Visual fallback if accessibility insufficient', which gives an implicit when-not condition. The description also frames this as the fast, cheap option versus visual analysis. Guidance is clear but selection criteria are mostly implicit rather than stated as explicit if-then rules.

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