Skip to main content
Glama

tap

Tap on Android screen coordinates to interact with apps and automate UI tasks. Use absolute pixels or normalized values for precise touch simulation.

Instructions

Tap at specific coordinates on the Android screen. Coordinates can be absolute pixels or normalized (0-1 range, will be scaled to screen size).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate (pixels or 0-1 normalized)
yYesY coordinate (pixels or 0-1 normalized)
device_idNoDevice serial number

Implementation Reference

  • The handler implementation for the tap tool, which resolves device ID, checks rate limits, validates coordinates, and executes the ADB tap command.
    export async function tap(x: number, y: number, deviceId?: string): Promise<{ x: number; y: number }> {
      const resolved = await deviceManager.resolveDeviceId(deviceId);
      deviceManager.checkRateLimit(resolved);
    
      const coords = await normalizeCoordinates(x, y, resolved);
      validateCoordinate(coords.x, 'x');
      validateCoordinate(coords.y, 'y');
    
      await adbShell(['input', 'tap', String(coords.x), String(coords.y)], resolved);
      deviceManager.touchSession(resolved);
    
      log.info('Tap performed', { x: coords.x, y: coords.y, deviceId: resolved });
      return coords;
    }
  • The MCP tool registration for 'tap', which handles input validation using zod, checks execution context, invokes the core tap handler, and performs post-action verification.
    server.registerTool(
      'tap',
      {
        description: 'Tap at specific coordinates on the Android screen. Coordinates can be absolute pixels or normalized (0-1 range, will be scaled to screen size).',
        inputSchema: {
          x: z.number().describe('X coordinate (pixels or 0-1 normalized)'),
          y: z.number().describe('Y coordinate (pixels or 0-1 normalized)'),
          device_id: z.string().optional().describe('Device serial number'),
        },
      },
      async ({ x, y, device_id }) => {
        return await metrics.measure('tap', device_id || 'default', async () => {
          const resolved = await deviceManager.resolveDeviceId(device_id);
          const execCtx = executionEngine.preExecutionCheck('tap', { x, y }, resolved);
    
          if (!execCtx.allowed) {
            return {
              content: [{
                type: 'text' as const,
                text: JSON.stringify({
                  success: false,
                  blocked: true,
                  reason: execCtx.blockReason,
                  _context: execCtx.recentContext,
                }, null, 2),
              }],
            };
          }
    
          const preHash = await capturePreActionState(resolved);
          const result = await tap(x, y, resolved);
          invalidateCaches(resolved);
          const verification = await verifyAction('tap', resolved, preHash);
    
          return buildVerifiedResponse({ tapped: result }, execCtx, verification);
        });
      }
    );
Behavior3/5

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

With no annotations provided, the description carries the full burden. It adds valuable behavioral context about coordinate scaling ('will be scaled to screen size'), but lacks disclosure of side effects, error behaviors (out-of-bounds coordinates), or whether the operation is idempotent.

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 consists of two efficient sentences with zero redundancy: the first establishes the core action, and the second provides critical implementation details about coordinate formats. Every word earns its place.

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

Completeness3/5

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

Given the absence of annotations and output schema, the description adequately covers the input parameters but omits expected return values, success/failure indicators, or error conditions that would help the agent handle the tool's output.

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

Parameters4/5

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

Although the schema has 100% description coverage (baseline 3), the description adds meaningful semantic context about the coordinate value ranges (0-1 normalization) and runtime behavior (scaling), enhancing understanding beyond the schema's basic type definitions.

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

Purpose5/5

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

The description clearly states the specific action ('Tap') and target ('specific coordinates on the Android screen'), effectively distinguishing it from sibling tools like click_element (which implies element-based targeting) and double_tap/long_press (which imply different gesture types).

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

Usage Guidelines3/5

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

While the description explains HOW to specify coordinates (absolute pixels vs normalized 0-1 range), it does not explicitly state WHEN to use this tool versus coordinate-based siblings (double_tap, long_press) or element-based alternatives (click_element).

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/divineDev-dotcom/android_mcp'

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