Skip to main content
Glama
andreahaku

Expo iOS Development MCP Server

by andreahaku

ui.tap

Tap on iOS Simulator UI elements using selectors like ID, text, or label to automate testing and interactions in React Native/Expo applications.

Instructions

Tap on an element identified by selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesElement selector.
xNoX offset from element center.
yNoY offset from element center.

Implementation Reference

  • Primary MCP tool registration and handler for 'ui.tap': parses args, generates Detox action snippet using generateTapSnippet, executes via runDetoxAction, handles errors, and returns formatted result.
    server.tool( "ui.tap", "Tap on an element identified by selector", UiTapInputSchema.shape, async (args) => { try { const snippet = generateTapSnippet({ selector: args.selector, x: args.x, y: args.y, }); const result = await runDetoxAction({ actionName: `tap:${describeSelector(args.selector)}`, actionSnippet: snippet, }); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; } catch (error) { return handleToolError(error); } } );
  • Zod input schema for ui.tap tool, referencing shared SelectorSchema for element identification.
    export const UiTapInputSchema = z.object({ selector: SelectorSchema.describe("Element selector."), x: z.number().optional().describe("X offset from element center."), y: z.number().optional().describe("Y offset from element center."), });
  • Core helper function that generates the Detox JavaScript snippet for the tap action based on selector and optional coordinates.
    export function generateTapSnippet(options: TapOptions): string { const el = buildElementExpr(options.selector); if (options.x !== undefined && options.y !== undefined) { return `await ${el}.tap({ x: ${options.x}, y: ${options.y} });`; } return `await ${el}.tap();`; }
  • Selector helpers: buildElementExpr constructs Detox element matcher string used in tap snippet; selectorToDetoxExpr maps MCP selector to Detox by.id/text/label.
    export function buildElementExpr(selector: Selector, index?: number): string { const matcher = selectorToDetoxExpr(selector); if (index !== undefined) { return `element(${matcher}).atIndex(${index})`; } return `element(${matcher})`; }
  • Internal ui.tap handler implementation within the flow.run tool executor (ToolExecutor).
    case "ui.tap": const tapSnippet = generateTapSnippet({ selector: input.selector as { by: "id" | "text" | "label"; value: string }, x: input.x as number | undefined, y: input.y as number | undefined, }); const tapResult = await runDetoxAction({ actionName: `tap:${(input.selector as { value: string }).value}`, actionSnippet: tapSnippet, }); return { success: tapResult.success, result: tapResult, error: tapResult.error?.message };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/andreahaku/expo_ios_development_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server