Skip to main content
Glama

swipe

Execute swipe gestures on iOS simulators by specifying start and end coordinates, enabling precise screen navigation and interaction automation for testing and development workflows.

Instructions

Perform a swipe gesture from one coordinate to another

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_xYesStart X coordinate in points
from_yYesStart Y coordinate in points
to_xYesEnd X coordinate in points
to_yYesEnd Y coordinate in points
duration_msNoSwipe duration in milliseconds (default: 500)
udidNoSimulator UDID (optional, defaults to booted simulator)

Implementation Reference

  • The handler method that implements the 'swipe' gesture using 'idb'.
    private async swipe(
      fromX: number,
      fromY: number,
      toX: number,
      toY: number,
      durationMs?: number,
      udid?: string
    ) {
      const target = await resolveUdid(udid);
      const durationSec = ((durationMs ?? 500) / 1000).toFixed(3);
      try {
        await execAsync(`idb ui swipe --udid ${target} ${fromX} ${fromY} ${toX} ${toY} --duration ${durationSec}`);
        return {
          content: [{ type: 'text', text: `Swiped (${fromX},${fromY}) to (${toX},${toY}) over ${durationMs ?? 500}ms on ${target}` }],
        };
      } catch (error: any) {
        throw new McpError(ErrorCode.InternalError, `Failed to swipe: ${error.message}`);
      }
  • The tool definition and schema for 'swipe'.
    name: 'swipe',
    description: 'Perform a swipe gesture from one coordinate to another',
    inputSchema: {
      type: 'object',
      properties: {
        from_x: { type: 'number', description: 'Start X coordinate in points' },
        from_y: { type: 'number', description: 'Start Y coordinate in points' },
        to_x: { type: 'number', description: 'End X coordinate in points' },
        to_y: { type: 'number', description: 'End Y coordinate in points' },
        duration_ms: { type: 'number', description: 'Swipe duration in milliseconds (default: 500)' },
        udid: { type: 'string', description: 'Simulator UDID (optional, defaults to booted simulator)' },
      },
      required: ['from_x', 'from_y', 'to_x', 'to_y'],
      additionalProperties: false,
    },
  • src/index.ts:526-527 (registration)
    The tool dispatch logic for 'swipe'.
    case 'swipe':
      return this.swipe(args.from_x, args.from_y, args.to_x, args.to_y, args.duration_ms, args.udid);

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