Skip to main content
Glama

tap_relative

Tap on iOS Simulator screens using relative coordinates to automate testing and control devices. Specify X and Y positions between 0 and 1 for precise interaction.

Instructions

Tap using relative coordinates (rx, ry) in [0,1] where (0.5, 0.5) is center.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rxYesRelative X in [0,1]
ryYesRelative Y in [0,1]
udidNoSimulator UDID (optional, defaults to booted simulator)

Implementation Reference

  • Implementation of the tap_relative tool logic.
    private async tapRelative(rx: number, ry: number, udid?: string) {
      if (!Number.isFinite(rx) || !Number.isFinite(ry) || rx < 0 || rx > 1 || ry < 0 || ry > 1) {
        throw new McpError(
          ErrorCode.InvalidRequest,
          'rx and ry must be finite numbers between 0 and 1.'
        );
      }
    
      const target = await resolveUdid(udid);
      try {
        const size = await this.getScreenSize(target);
        const x = Math.round(size.width * rx);
        const y = Math.round(size.height * ry);
    
        await execAsync(`idb ui tap --udid ${target} ${x} ${y}`);
  • Tool registration and schema definition for tap_relative.
    {
      name: 'tap_relative',
      description: 'Tap using relative coordinates (rx, ry) in [0,1] where (0.5, 0.5) is center.',
      inputSchema: {
        type: 'object',
        properties: {
          rx: { type: 'number', description: 'Relative X in [0,1]' },
          ry: { type: 'number', description: 'Relative Y in [0,1]' },
          udid: { type: 'string', description: 'Simulator UDID (optional, defaults to booted simulator)' },
        },
        required: ['rx', 'ry'],
        additionalProperties: false,
      },

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/xmuweili/app-screen-mcp'

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