Skip to main content
Glama

android_get_latest_frame

Capture the current screen from an Android device via ADB with immediate access and no delay for real-time monitoring or analysis.

Instructions

Get the latest frame from scrcpy stream (instant access, no latency)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'android_get_latest_frame' tool. It retrieves the latest frame buffer from the ADB wrapper's cache and returns it as a base64-encoded H.264 image or an error message if no frame is available.
    export async function handleGetLatestFrame(adb: ADBWrapper, args: GetLatestFrameArgs): Promise<{ content: Array<{ type: string; text?: string; data?: string; mimeType?: string }> }> {
      try {
        const frame = adb.getLatestFrame();
    
        if (!frame) {
          return {
            content: [
              {
                type: 'text',
                text: 'No frame available. Start streaming first with startScrcpyStream.',
              },
            ],
          };
        }
    
        // Return frame as base64-encoded image
        return {
          content: [
            {
              type: 'image',
              data: frame.toString('base64'),
              mimeType: 'image/h264',
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to get latest frame: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • The tool schema definition provided in the ListTools response, specifying the name, description, and empty input schema (no parameters required).
      name: 'android_get_latest_frame',
      description: 'Get the latest frame from scrcpy stream (instant access, no latency)',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • src/index.ts:498-499 (registration)
    The switch case registration in the CallToolRequestHandler that routes calls to the 'android_get_latest_frame' tool to the handleGetLatestFrame function.
    case 'android_get_latest_frame':
      return await handleGetLatestFrame(this.adb, args as any);
  • TypeScript interface defining the expected arguments for the handler (empty object).
    interface GetLatestFrameArgs {
      // No arguments needed
    }
  • Supporting method in ADBWrapper that returns the cached latest frame buffer used by the handler.
    getLatestFrame(): Buffer | null {
      return this.latestFrame;
    }
Behavior2/5

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

With no annotations, the description carries full burden but only mentions 'instant access, no latency'. It omits critical behavioral details: whether this is read-only or modifies state, potential errors if the stream isn't running, return format (e.g., image data), or performance implications like memory usage.

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 that front-loads the core purpose ('Get the latest frame') and adds qualifying context ('instant access, no latency'). Every word earns its place with no redundancy or fluff.

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 of accessing a live stream and no annotations or output schema, the description is incomplete. It fails to explain prerequisites (e.g., stream must be active), error conditions, or return value format, leaving significant gaps for safe and effective tool invocation.

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?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately adds no parameter details, focusing on tool behavior instead, which aligns with the baseline for zero parameters.

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 ('Get') and resource ('latest frame from scrcpy stream'), specifying it provides 'instant access, no latency'. It distinguishes from sibling 'android_capture_frame_scrcpy' by emphasizing immediacy versus potential capture delay, though not explicitly naming the alternative.

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?

The description implies usage when low-latency frame access is needed from an active scrcpy stream, as suggested by 'instant access, no latency'. However, it lacks explicit guidance on prerequisites (e.g., requiring 'android_start_scrcpy_stream' first) or clear alternatives like 'android_screenshot' for non-stream contexts.

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/jduartedj/android-mcp-server'

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