Skip to main content
Glama

ui_swipe

Simulates swipe gestures on the iOS Simulator screen by defining start and end coordinates, enabling precise UI interaction testing and control.

Instructions

Swipe on the screen in the iOS Simulator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deltaNoThe size of each step in the swipe (default is 1)
udidNoUdid of target, can also be set with the IDB_UDID env var
x_endYesThe ending x-coordinate
x_startYesThe starting x-coordinate
y_endYesThe ending y-coordinate
y_startYesThe starting y-coordinate

Implementation Reference

  • The handler function that executes the ui_swipe tool logic by calling the idb CLI with swipe parameters.
    async ({ duration, udid, x_start, y_start, x_end, y_end, delta }) => { try { const actualUdid = await getBootedDeviceId(udid); const { stderr } = await idb( "ui", "swipe", "--udid", actualUdid, ...(duration ? ["--duration", duration] : []), ...(delta ? ["--delta", String(delta)] : []), "--json", // When passing user-provided values to a command, it's crucial to use `--` // to separate the command's options from positional arguments. // This prevents the shell from misinterpreting the arguments as options. "--", String(x_start), String(y_start), String(x_end), String(y_end) ); if (stderr) throw new Error(stderr); return { isError: false, content: [{ type: "text", text: "Swiped successfully" }], }; } catch (error) { return { isError: true, content: [ { type: "text", text: errorWithTroubleshooting( `Error swiping on the screen: ${toError(error).message}` ), }, ], }; } }
  • Zod schema defining the input parameters for the ui_swipe tool, including coordinates, optional duration, udid, and delta.
    duration: z .string() .regex(/^\d+(\.\d+)?$/) .optional() .describe("Swipe duration in seconds (e.g., 0.1)"), udid: z .string() .regex(UDID_REGEX) .optional() .describe("Udid of target, can also be set with the IDB_UDID env var"), x_start: z.number().describe("The starting x-coordinate"), y_start: z.number().describe("The starting y-coordinate"), x_end: z.number().describe("The ending x-coordinate"), y_end: z.number().describe("The ending y-coordinate"), delta: z .number() .optional() .describe("The size of each step in the swipe (default is 1)") .default(1), },
  • src/index.ts:387-455 (registration)
    Registration of the ui_swipe tool using server.tool, conditionally filtered by isToolFiltered.
    if (!isToolFiltered("ui_swipe")) { server.tool( "ui_swipe", "Swipe on the screen in the iOS Simulator", { duration: z .string() .regex(/^\d+(\.\d+)?$/) .optional() .describe("Swipe duration in seconds (e.g., 0.1)"), udid: z .string() .regex(UDID_REGEX) .optional() .describe("Udid of target, can also be set with the IDB_UDID env var"), x_start: z.number().describe("The starting x-coordinate"), y_start: z.number().describe("The starting y-coordinate"), x_end: z.number().describe("The ending x-coordinate"), y_end: z.number().describe("The ending y-coordinate"), delta: z .number() .optional() .describe("The size of each step in the swipe (default is 1)") .default(1), }, async ({ duration, udid, x_start, y_start, x_end, y_end, delta }) => { try { const actualUdid = await getBootedDeviceId(udid); const { stderr } = await idb( "ui", "swipe", "--udid", actualUdid, ...(duration ? ["--duration", duration] : []), ...(delta ? ["--delta", String(delta)] : []), "--json", // When passing user-provided values to a command, it's crucial to use `--` // to separate the command's options from positional arguments. // This prevents the shell from misinterpreting the arguments as options. "--", String(x_start), String(y_start), String(x_end), String(y_end) ); if (stderr) throw new Error(stderr); return { isError: false, content: [{ type: "text", text: "Swiped successfully" }], }; } catch (error) { return { isError: true, content: [ { type: "text", text: errorWithTroubleshooting( `Error swiping on the screen: ${toError(error).message}` ), }, ], }; } } ); }

Other Tools

Related Tools

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/joshuayoes/ios-simulator-mcp'

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