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

XC-MCP: XCode CLI wrapper

by conorluddy

Tap Element (Workflow)

workflow-tap-element

Find and tap app UI elements by name or label, optionally enter text, and verify the result in one accessibility-first call, reducing coordinate hunting and context use.

Instructions

workflow-tap-element

High-level semantic UI interaction - find and tap elements by name without coordinate hunting.

Overview

Orchestrates accessibility-first UI automation in a single call:

  1. Check Accessibility - Assess UI richness for automation approach

  2. Find Element - Semantic search by label/identifier

  3. Tap Element - Press a uniquely matched control through accessibility; otherwise tap discovered coordinates

  4. Input Text (optional) - Type into tapped field

  5. Verify Result (optional) - Screenshot for confirmation

This workflow keeps intermediate results internal, reducing agent context usage by ~80% compared to calling each tool manually.

Parameters

Required

  • elementQuery (string): Search term for element (e.g., "Login", "Submit", "Email")

    • Case-insensitive partial matching ("log" matches "Login")

Optional

  • inputText (string): Text to type after tapping (for text fields)

  • verifyResult (boolean): Take screenshot after action (default: false)

  • udid (string): Target device - auto-detected if omitted

  • screenContext (string): Screen name for tracking (e.g., "LoginScreen")

Returns

Consolidated result with:

  • success: Overall workflow success

  • tappedElement: Found element details (type, label, coordinates)

  • inputText: Text entry status (if requested)

  • verified: Screenshot status (if requested)

  • accessibilityQuality: UI richness assessment

  • totalDuration: Total workflow time

  • guidance: Next steps

Examples

Tap Login Button

{"elementQuery": "Login"}

Finds and taps the Login button.

Tap Email Field and Enter Text

{
  "elementQuery": "Email",
  "inputText": "user@example.com",
  "screenContext": "LoginScreen"
}

Finds email field, taps it, enters text.

Full Verification Workflow

{
  "elementQuery": "Submit",
  "verifyResult": true,
  "screenContext": "SignupForm"
}

Taps Submit button and captures verification screenshot.

Why Use This Workflow?

Token Efficiency

  • Manual approach: 4-5 tool calls × ~50 tokens each = ~200+ tokens in responses

  • Workflow approach: 1 call with consolidated response = ~80 tokens

Reduced Context Pollution

  • Intermediate accessibility data not exposed

  • Element search results summarized

  • Only actionable outcome returned

Error Handling

  • Graceful degradation on partial failures

  • Helpful guidance when element not found

  • Clear troubleshooting steps

  • idb-ui-find-element: Direct element search (used internally)

  • idb-semantic-action: Accessibility press with uniqueness checks (used internally)

  • idb-ui-tap: Coordinate tap (used internally)

  • accessibility-quality-check: Direct quality check (used internally)

  • workflow-fresh-install: Clean app installation workflow

Notes

  • Falls back gracefully if accessibility is minimal

  • Non-fatal errors (input, screenshot) don't fail the workflow

  • Element matching uses partial, case-insensitive search

  • A single Button/Link/Switch/CheckBox/Tab match uses an accessibility press with coordinate fallback in the action tool

  • A rejected semantic action fails the workflow; it is never retried with an unguarded coordinate tap

  • Small delay between tap and input for keyboard appearance

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "elementQuery": "<elementQuery>"
    },
    "name": "workflow-tap-element"
  }
}

Input Schema

NameRequiredDescriptionDefault
udidNoTarget device
inputTextNoText to type after tapping
elementQueryYesSearch term for element (e.g., "Login", "Submit")
verifyResultNoTake screenshot after action
screenContextNoScreen name for tracking

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 only establish the safety profile (mutating, non-destructive, non-idempotent, closed-world); the description adds substantial behavior on top: graceful degradation, non-fatal input/screenshot failures not failing the run, a rejected semantic action failing the workflow rather than falling back to an unguarded coordinate tap, and a delay between tap and text input. These are exactly the execution traits an agent cannot infer from the annotations.

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

Conciseness4/5

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

Strongly front-loaded with headers and a clear ordering (overview → params → returns → examples → notes), and the Returns section is warranted because no output schema exists. It runs long, with a somewhat promotional token-efficiency section and three examples where one or two would convey the same parameter semantics.

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?

For a multi-step mutating workflow with no output schema, the description supplies everything an agent needs: internal steps, the consolidated return shape, fallback/error semantics, and where the underlying primitives live. Nothing material is left to inference.

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 100%, so baseline is 3, but the description adds real meaning: case-insensitive partial matching ('log' matches 'Login'), udid auto-detection when omitted, inputText only applying to text fields, and screenContext being purely for tracking. Examples map parameter combinations to intended scenarios.

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?

Opens with a specific verb+resource+scope: 'find and tap elements by name without coordinate hunting', which immediately separates it from coordinate-based idb-ui-tap and search-only idb-ui-find-element. The numbered orchestration list makes the exact composition of the workflow explicit.

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?

'Why Use This Workflow?' gives a concrete selection rationale (one consolidated call vs 4-5 manual calls, ~80% fewer tokens) and the Related Tools section names the direct alternatives it wraps. It stops short of an explicit when-not-to-use rule (e.g. when you need the raw accessibility tree or a custom gesture, use idb-ui-describe/idb-ui-gesture instead).

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