Skip to main content
Glama

ui-action

Automate Android app UI interactions: tap elements, input text, and scroll screens to test and debug applications directly through the development environment.

Instructions

Interact with app UI: tap, input, scroll.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYes
xNo
yNo
elementIndexNo
textNo
directionNo
amountNoScroll fraction (0-1, default: 0.5)
deviceSpaceNoTreat x/y as device coordinates (skip scaling)

Implementation Reference

  • Main handler function for the 'ui-action' tool, which dispatches to specific operation handlers (tap, input, scroll).
    export async function handleUiActionTool(
      input: UiActionInput,
      context: ServerContext,
    ): Promise<Record<string, unknown>> {
      const device = await context.deviceState.ensureDevice(context.adb);
    
      const handler = operations[input.operation];
      if (!handler) {
        throw new ReplicantError(
          ErrorCode.INVALID_OPERATION,
          `Unknown operation: ${input.operation}`,
          "Valid operations: tap, input, scroll",
        );
      }
      return handler(input, context, device.id);
    }
  • Input schema definition for the 'ui-action' tool using Zod.
    export const uiActionInputSchema = z.object({
      operation: z.enum(["tap", "input", "scroll"]),
      x: z.number().optional(),
      y: z.number().optional(),
      elementIndex: z.number().optional(),
      text: z.string().optional(),
      direction: z.enum(["up", "down", "left", "right"]).optional(),
      amount: z.number().min(0).max(1).optional(),
      deviceSpace: z.boolean().optional(),
    });
    
    export type UiActionInput = z.infer<typeof uiActionInputSchema>;
  • Definition object for registering the 'ui-action' tool with the MCP server.
    export const uiActionToolDefinition = {
      name: "ui-action",
      description: "Interact with app UI: tap, input, scroll.",
      inputSchema: {
        type: "object",
        properties: {
          operation: {
            type: "string",
            enum: ["tap", "input", "scroll"],
          },
          x: { type: "number" },
          y: { type: "number" },
          elementIndex: { type: "number" },
          text: { type: "string" },
          direction: { type: "string", enum: ["up", "down", "left", "right"] },
          amount: { type: "number", minimum: 0, maximum: 1, description: "Scroll fraction (0-1, default: 0.5)" },
          deviceSpace: { type: "boolean", description: "Treat x/y as device coordinates (skip scaling)" },
        },
        required: ["operation"],
      },
      annotations: {
        readOnlyHint: false,
        destructiveHint: true,
        idempotentHint: false,
        openWorldHint: false,
      },
    };
Behavior2/5

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

No annotations are provided, yet the description fails to disclose critical behavioral traits: what happens if an element is not found or not visible, whether operations are synchronous/blocking, coordinate system details (only partially covered by the deviceSpace parameter description), or failure modes for the input operation.

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

Conciseness3/5

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

The single sentence is efficiently structured with the colon placing key verbs prominently. However, for a tool with 8 parameters and complex conditional logic, it is inappropriately brief—undersized rather than truly concise.

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 8 parameters with only 25% schema coverage, no output schema, and no annotations, the description is insufficient. It lacks explanation of return values, error handling, coordinate system semantics, and the mutual exclusivity or relationship between x/y and elementIndex parameters.

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?

With only 25% schema description coverage, the description must compensate for undocumented parameters (x, y, elementIndex, text, direction). It only lists the operation types without explaining the critical relationships between the operation parameter and its required co-parameters (e.g., that 'input' requires 'text', 'scroll' requires 'direction').

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 states the basic actions (tap, input, scroll) and target (app UI), providing a minimally viable purpose statement. However, 'Interact' is vague and it fails to differentiate from siblings like adb-shell (which can also interact with UI via shell commands) or clarify why one would use this over ui-query for element targeting.

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 provided on when to use this tool versus alternatives like adb-shell for UI automation, or prerequisites such as app state/visibility requirements. No mention of when to use x/y coordinates versus elementIndex parameter.

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/thecombatwombat/replicant-mcp'

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