Skip to content

Commit faf0047

Browse files
committed
docs(ui-automation): prefer label/id targets for tap guidance
Recommend accessibility targeting (id/label) before coordinates for ui-automation tap interactions.\n\nUpdate tap tool schema and manifest descriptions, validation guidance, and XcodeBuildMCP skill docs to keep guidance consistent across MCP and CLI usage.\n\nCo-Authored-By: Claude <noreply@anthropic.com>
1 parent c14c159 commit faf0047

File tree

6 files changed

+35
-12
lines changed

6 files changed

+35
-12
lines changed

docs/TOOLS-CLI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ XcodeBuildMCP provides 71 canonical tools organized into 13 workflow groups.
164164
- `screenshot` - Defined in iOS Simulator Development workflow.
165165
- `snapshot-ui` - Defined in iOS Simulator Development workflow.
166166
- `swipe` - Swipe between points.
167-
- `tap` - Tap coordinate or element.
167+
- `tap` - Tap UI element by accessibility id/label (recommended) or coordinates as fallback.
168168
- `touch` - Touch down/up at coords.
169169
- `type-text` - Type text.
170170

@@ -187,4 +187,4 @@ XcodeBuildMCP provides 71 canonical tools organized into 13 workflow groups.
187187

188188
---
189189

190-
*This documentation is automatically generated by `scripts/update-tools-docs.ts` from the tools manifest. Last updated: 2026-02-08T12:09:33.648Z UTC*
190+
*This documentation is automatically generated by `scripts/update-tools-docs.ts` from the tools manifest. Last updated: 2026-02-11T13:12:19.881Z UTC*

docs/TOOLS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ This document lists MCP tool names as exposed to MCP clients. XcodeBuildMCP prov
172172
- `screenshot` - Defined in iOS Simulator Development workflow.
173173
- `snapshot_ui` - Defined in iOS Simulator Development workflow.
174174
- `swipe` - Swipe between points.
175-
- `tap` - Tap coordinate or element.
175+
- `tap` - Tap UI element by accessibility id/label (recommended) or coordinates as fallback.
176176
- `touch` - Touch down/up at coords.
177177
- `type_text` - Type text.
178178

@@ -202,4 +202,4 @@ This document lists MCP tool names as exposed to MCP clients. XcodeBuildMCP prov
202202

203203
---
204204

205-
*This documentation is automatically generated by `scripts/update-tools-docs.ts` from the tools manifest. Last updated: 2026-02-08T12:09:33.648Z UTC*
205+
*This documentation is automatically generated by `scripts/update-tools-docs.ts` from the tools manifest. Last updated: 2026-02-11T13:12:19.881Z UTC*

manifests/tools/tap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module: mcp/tools/ui-automation/tap
33
names:
44
mcp: tap
55
cli: tap
6-
description: Tap coordinate or element.
6+
description: Tap UI element by accessibility id/label (recommended) or coordinates as fallback.
77
annotations:
88
title: Tap
99
destructiveHint: true

skills/xcodebuildmcp-cli/SKILL.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ Snapshot UI accessibility tree, tap/swipe/type, and capture screenshots:
112112

113113
```bash
114114
xcodebuildmcp ui-automation snapshot-ui --simulator-id SIMULATOR_UDID
115+
xcodebuildmcp ui-automation tap --simulator-id SIMULATOR_UDID --label "Submit"
116+
xcodebuildmcp ui-automation tap --simulator-id SIMULATOR_UDID --id "SubmitButton"
117+
# Coordinate fallback when label/id is unavailable
115118
xcodebuildmcp ui-automation tap --simulator-id SIMULATOR_UDID --x 200 --y 400
116119
xcodebuildmcp ui-automation type-text --simulator-id SIMULATOR_UDID --text "hello"
117120
xcodebuildmcp ui-automation screenshot --simulator-id SIMULATOR_UDID --return-format path

skills/xcodebuildmcp/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ Before you call any other tools, you **must** call `session_show_defaults` to sh
152152
- `screenshot`
153153
- Capture screenshot.
154154
- `snapshot_ui`
155-
- Print view hierarchy with precise view coordinates (x, y, width, height) for visible elements.
155+
- Print view hierarchy with element ids/labels and precise coordinates (x, y, width, height) for visible elements.
156156
- `swipe`
157157
- Swipe between points.
158158
- `tap`
159-
- Tap coordinate or element.
159+
- Tap UI element by accessibility id/label (recommended) or coordinates as fallback.
160160
- `touch`
161161
- Touch down/up at coords.
162162
- `type_text`

src/mcp/tools/ui-automation/tap.ts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,30 @@ export interface AxeHelpers {
2828
// Define schema as ZodObject
2929
const baseTapSchema = z.object({
3030
simulatorId: z.uuid({ message: 'Invalid Simulator UUID format' }),
31-
x: z.number().int({ message: 'X coordinate must be an integer' }).optional(),
32-
y: z.number().int({ message: 'Y coordinate must be an integer' }).optional(),
33-
id: z.string().min(1, { message: 'Id must be non-empty' }).optional(),
34-
label: z.string().min(1, { message: 'Label must be non-empty' }).optional(),
31+
x: z
32+
.number()
33+
.int({ message: 'X coordinate must be an integer' })
34+
.optional()
35+
.describe(
36+
'Fallback tap X coordinate. Prefer label/id targeting first; use coordinates when accessibility targeting is unavailable.',
37+
),
38+
y: z
39+
.number()
40+
.int({ message: 'Y coordinate must be an integer' })
41+
.optional()
42+
.describe(
43+
'Fallback tap Y coordinate. Prefer label/id targeting first; use coordinates when accessibility targeting is unavailable.',
44+
),
45+
id: z
46+
.string()
47+
.min(1, { message: 'Id must be non-empty' })
48+
.optional()
49+
.describe('Recommended tap target: accessibility element id (AXUniqueId).'),
50+
label: z
51+
.string()
52+
.min(1, { message: 'Label must be non-empty' })
53+
.optional()
54+
.describe('Recommended when unique: accessibility label (AXLabel).'),
3555
preDelay: z
3656
.number()
3757
.min(0, { message: 'Pre-delay must be non-negative' })
@@ -79,7 +99,7 @@ const tapSchema = baseTapSchema.superRefine((values, ctx) => {
7999
ctx.addIssue({
80100
code: z.ZodIssueCode.custom,
81101
path: ['x'],
82-
message: 'Provide x/y coordinates or an element id/label.',
102+
message: 'Provide an element id/label (recommended) or x/y coordinates as fallback.',
83103
});
84104
}
85105
});

0 commit comments

Comments
 (0)