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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but lacks critical details: it doesn't specify if this gesture simulates user input on a UI, mention any side effects (e.g., triggering app navigation), describe error conditions (e.g., invalid coordinates), or note performance aspects like execution time. This leaves significant gaps for an agent to understand the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action ('perform a swipe gesture') and specifies the key aspect ('from one coordinate to another'), making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a gesture-based interaction tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns (e.g., success status, error messages), behavioral nuances like coordinate system origin or bounds, or integration with sibling tools (e.g., requiring a booted simulator). This leaves the agent with incomplete context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting all six parameters (coordinates, duration, and UDID) with their types and purposes. The description adds no additional parameter semantics beyond implying coordinate-based movement, which is already covered by the schema. This meets the baseline score since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('perform a swipe gesture') and specifies the movement ('from one coordinate to another'), making the purpose evident. However, it doesn't differentiate this tool from similar sibling tools like 'tap' or 'press_button', which would require mentioning it's specifically for continuous touch movement across coordinates.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'tap' (for single-point touches) or 'press_button' (for button interactions). It also doesn't mention prerequisites such as needing a simulator to be booted or an app to be launched, which are implied by sibling tools but not explicitly stated here.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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