Skip to main content
Glama
andreahaku

Expo iOS Development MCP Server

by andreahaku

ui.long_press

Perform long press interactions on iOS Simulator UI elements for React Native/Expo app testing. Simulate user gestures by pressing elements for specified durations to test touch interactions and accessibility features.

Instructions

Long press on an element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesElement selector.
durationNoPress duration in milliseconds.

Implementation Reference

  • Primary handler and registration for the 'ui.long_press' MCP tool. Generates a Detox action snippet and executes it via runDetoxAction.
    server.tool(
      "ui.long_press",
      "Long press on an element",
      UiLongPressInputSchema.shape,
      async (args) => {
        try {
          const snippet = generateLongPressSnippet({
            selector: args.selector,
            duration: args.duration,
          });
          const result = await runDetoxAction({
            actionName: `longPress:${describeSelector(args.selector)}`,
            actionSnippet: snippet,
          });
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result, null, 2),
              },
            ],
            isError: !result.success,
          };
        } catch (error) {
          return handleToolError(error);
        }
      }
    );
  • Zod input schema for ui.long_press tool parameters: selector and optional duration.
    export const UiLongPressInputSchema = z.object({
      selector: SelectorSchema.describe("Element selector."),
      duration: z.number().optional().default(1000).describe("Press duration in milliseconds."),
    });
  • Helper function that generates the Detox JavaScript snippet for performing a long press action on an element.
    export interface LongPressOptions {
      selector: Selector;
      duration?: number;
    }
    
    export function generateLongPressSnippet(options: LongPressOptions): string {
      const el = buildElementExpr(options.selector);
      const duration = options.duration ?? 1000;
      return `await ${el}.longPress(${duration});`;
    }
  • Helper to build Detox element expression from MCP selector, used in snippet generation.
    export function buildElementExpr(selector: Selector, index?: number): string {
      const matcher = selectorToDetoxExpr(selector);
      if (index !== undefined) {
        return `element(${matcher}).atIndex(${index})`;
      }
      return `element(${matcher})`;
    }
  • Helper to create a human-readable description of the selector for action names.
    export function describeSelector(selector: Selector): string {
      return `${selector.by}="${selector.value}"`;
    }
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 doesn't mention side effects (e.g., triggering context menus), error handling, or performance implications. This is inadequate for a UI interaction tool with potential side effects.

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 with zero waste. It's front-loaded and appropriately sized for the tool's complexity, 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 no annotations and no output schema, the description is incomplete. It doesn't explain what happens after the long press (e.g., UI changes, return values) or address potential complexities like element visibility or timing issues, which are critical for UI testing tools.

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?

Schema description coverage is 100%, with clear documentation for 'selector' and 'duration'. The description adds no extra meaning beyond the schema, such as examples or edge cases, but the schema is comprehensive, so a baseline score of 3 is appropriate.

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

Purpose3/5

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

The description 'Long press on an element' clearly states the action (long press) and target (an element), but it's vague about the context (e.g., mobile UI testing) and doesn't differentiate from siblings like 'ui.tap' or 'ui.swipe'. It provides a basic purpose but lacks specificity.

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?

No guidance is provided on when to use this tool versus alternatives such as 'ui.tap' for short taps or 'ui.swipe' for swipes. The description offers no context, prerequisites, or exclusions, leaving usage unclear.

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/andreahaku/expo_ios_development_mcp'

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