Skip to main content
Glama

ui-capture

Capture screenshots and visual snapshots from Android applications to document UI states and identify visual changes during development and testing.

Instructions

Capture screenshots or visual snapshots.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYes
localPathNo
inlineNo
maxDimensionNoMax image dimension in pixels (default: 800). Higher = better quality, more tokens.
rawNoSkip scaling, full device resolution.

Implementation Reference

  • The main handler function for the 'ui-capture' tool.
    export async function handleUiCaptureTool(
      input: UiCaptureInput,
      context: ServerContext,
      uiConfig?: UiConfig,
    ): Promise<Record<string, unknown>> {
      const device = await context.deviceState.ensureDevice(context.adb);
      const config = uiConfig ?? DEFAULT_CONFIG.ui;
    
      const handler = operations[input.operation];
      if (!handler) {
        throw new ReplicantError(
          ErrorCode.INVALID_OPERATION,
          `Unknown operation: ${input.operation}`,
          "Valid operations: screenshot, visual-snapshot",
        );
      }
      return handler(input, context, config, device.id);
    }
  • The Zod schema defining the input for the 'ui-capture' tool.
    export const uiCaptureInputSchema = z.object({
      operation: z.enum(["screenshot", "visual-snapshot"]),
      localPath: z.string().optional(),
      inline: z.boolean().optional(),
      maxDimension: z.number().optional(),
      raw: z.boolean().optional(),
    });
  • The tool definition object containing the name, description, and inputSchema for 'ui-capture'.
    export const uiCaptureToolDefinition = {
      name: "ui-capture",
      description: "Capture screenshots or visual snapshots.",
      inputSchema: {
        type: "object",
        properties: {
          operation: {
            type: "string",
            enum: ["screenshot", "visual-snapshot"],
          },
          localPath: { type: "string" },
          inline: { type: "boolean" },
          maxDimension: {
            type: "number",
            description: `Max image dimension in pixels (default: ${DEFAULT_CONFIG.ui.maxImageDimension}). Higher = better quality, more tokens.`,
          },
          raw: { type: "boolean", description: "Skip scaling, full device resolution." },
        },
        required: ["operation"],
      },
      annotations: {
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: false,
        openWorldHint: false,
      },
    };
Behavior2/5

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

With no annotations provided, the description carries full burden but discloses no behavioral traits. It doesn't explain output format (file path? base64?), storage location, overwrite behavior, execution time, or whether 'inline' affects the return value.

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

Conciseness4/5

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

Extremely concise at five words with no filler. However, this brevity crosses into under-specification—it's front-loaded but lacks the necessary depth for a tool with five parameters and no annotations.

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?

Inadequate for the tool's complexity. With five parameters, no output schema, no annotations, and mutation-adjacent behavior (file system interaction), the description should explain side effects, return values, and parameter relationships. It provides none of this.

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 coverage is only 40%. While the description implicitly maps 'screenshots or visual snapshots' to the 'operation' enum values, it completely ignores 'localPath' (file destination?), 'inline' (return data vs save?), and doesn't clarify the trade-offs between 'raw' and 'maxDimension'.

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 uses a specific verb ('Capture') and identifies the resource ('screenshots or visual snapshots'), clearly stating the core function. However, it fails to distinguish from siblings like 'ui-action' or specify the domain (Android/emulator), though the basic purpose is clear.

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 'ui-query' or 'adb-shell screencap'. No mention of prerequisites (e.g., requiring a running emulator/device) or when to choose 'screenshot' vs 'visual-snapshot' operations.

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