Skip to main content
Glama

swipe

Perform precise swipes on iOS simulators by defining exact coordinates and timing parameters. Use describe_ui for accuracy and avoid guessing from screenshots. Integrates with XcodeBuildMCP for streamlined testing.

Instructions

Swipe from one point to another. Use describe_ui for precise coordinates (don't guess from screenshots). Supports configurable timing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deltaNo
durationNo
postDelayNo
preDelayNo
simulatorUuidYes
x1Yes
x2Yes
y1Yes
y2Yes

Implementation Reference

  • Core handler function that parses parameters, constructs the axe 'swipe' command arguments, executes it on the iOS simulator, handles responses, warnings, and errors.
    export async function swipeLogic(
      params: SwipeParams,
      executor: CommandExecutor,
      axeHelpers: AxeHelpers = {
        getAxePath,
        getBundledAxeEnvironment,
        createAxeNotAvailableResponse,
      },
    ): Promise<ToolResponse> {
      const toolName = 'swipe';
    
      const { simulatorId, x1, y1, x2, y2, duration, delta, preDelay, postDelay } = params;
      const commandArgs = [
        'swipe',
        '--start-x',
        String(x1),
        '--start-y',
        String(y1),
        '--end-x',
        String(x2),
        '--end-y',
        String(y2),
      ];
      if (duration !== undefined) {
        commandArgs.push('--duration', String(duration));
      }
      if (delta !== undefined) {
        commandArgs.push('--delta', String(delta));
      }
      if (preDelay !== undefined) {
        commandArgs.push('--pre-delay', String(preDelay));
      }
      if (postDelay !== undefined) {
        commandArgs.push('--post-delay', String(postDelay));
      }
    
      const optionsText = duration ? ` duration=${duration}s` : '';
      log(
        'info',
        `${LOG_PREFIX}/${toolName}: Starting swipe (${x1},${y1})->(${x2},${y2})${optionsText} on ${simulatorId}`,
      );
    
      try {
        await executeAxeCommand(commandArgs, simulatorId, 'swipe', executor, axeHelpers);
        log('info', `${LOG_PREFIX}/${toolName}: Success for ${simulatorId}`);
    
        const warning = getCoordinateWarning(simulatorId);
        const message = `Swipe from (${x1}, ${y1}) to (${x2}, ${y2})${optionsText} simulated successfully.`;
    
        if (warning) {
          return createTextResponse(`${message}\n\n${warning}`);
        }
    
        return createTextResponse(message);
      } catch (error) {
        log('error', `${LOG_PREFIX}/${toolName}: Failed - ${error}`);
        if (error instanceof DependencyError) {
          return axeHelpers.createAxeNotAvailableResponse();
        } else if (error instanceof AxeError) {
          return createErrorResponse(`Failed to simulate swipe: ${error.message}`, error.axeOutput);
        } else if (error instanceof SystemError) {
          return createErrorResponse(
            `System error executing axe: ${error.message}`,
            error.originalError?.stack,
          );
        }
        return createErrorResponse(
          `An unexpected error occurred: ${error instanceof Error ? error.message : String(error)}`,
        );
      }
    }
  • Zod schema defining the input parameters for the swipe tool including required simulatorId, start/end coordinates, and optional timing parameters.
    const swipeSchema = z.object({
      simulatorId: z.string().uuid('Invalid Simulator UUID format'),
      x1: z.number().int('Start X coordinate'),
      y1: z.number().int('Start Y coordinate'),
      x2: z.number().int('End X coordinate'),
      y2: z.number().int('End Y coordinate'),
      duration: z.number().min(0, 'Duration must be non-negative').optional(),
      delta: z.number().min(0, 'Delta must be non-negative').optional(),
      preDelay: z.number().min(0, 'Pre-delay must be non-negative').optional(),
      postDelay: z.number().min(0, 'Post-delay must be non-negative').optional(),
    });
  • Default export registering the 'swipe' tool with name, description, public schema (omitting simulatorId), and handler created by createSessionAwareTool that wraps the swipeLogic function.
    export default {
      name: 'swipe',
      description:
        "Swipe from one point to another. Use describe_ui for precise coordinates (don't guess from screenshots). Supports configurable timing.",
      schema: publicSchemaObject.shape, // MCP SDK compatibility
      handler: createSessionAwareTool<SwipeParams>({
        internalSchema: swipeSchema as unknown as z.ZodType<SwipeParams>,
        logicFunction: (params: SwipeParams, executor: CommandExecutor) =>
          swipeLogic(params, executor, {
            getAxePath,
            getBundledAxeEnvironment,
            createAxeNotAvailableResponse,
          }),
        getExecutor: getDefaultCommandExecutor,
        requirements: [{ allOf: ['simulatorId'], message: 'simulatorId is required' }],
      }),
    };
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'configurable timing' which hints at the duration/preDelay/postDelay parameters, but doesn't explain what a swipe actually does (e.g., UI interaction, gesture simulation), whether it requires specific simulator state, or what happens on execution. For a tool with 9 parameters and no annotations, this is insufficient behavioral context.

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 perfectly concise with three short sentences that each add value: the core action, coordinate sourcing guidance, and timing capability. No wasted words, and the most important information (what the tool does) comes first.

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 (9 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain the tool's effect, return values, error conditions, or relationships to other tools beyond the single mention of describe_ui. For a UI interaction tool with many parameters, more context is needed.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It only vaguely references 'configurable timing' and coordinates, but doesn't explain what x1/y1/x2/y2 represent (start/end points), what delta means, what simulatorUuid is for, or units for timing parameters. The description adds minimal value beyond the bare schema.

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 ('Swipe from one point to another') and resource (UI coordinates), making the purpose immediately understandable. It distinguishes from siblings like 'tap' or 'gesture' by specifying a swipe motion, though it doesn't explicitly contrast with similar tools like 'long_press' or 'touch'.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool: 'Use describe_ui for precise coordinates (don't guess from screenshots).' This gives practical guidance on parameter sourcing. However, it doesn't specify when NOT to use it or mention alternatives among sibling tools like 'gesture' or 'touch'.

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

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/getsentry/XcodeBuildMCP'

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