Skip to main content
Glama

get_device_info

Retrieve Android device specifications including model, manufacturer, Android version, API level, screen size, and DPI for debugging and automation purposes.

Instructions

Get device details: model, manufacturer, Android version, API level, screen size, and DPI.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idNoDevice ID (optional if only one device)

Implementation Reference

  • The actual implementation of fetching device info, utilizing ADB commands.
    async getDeviceInfo(
      deviceId?: string,
    ): Promise<{
      model: string;
      manufacturer: string;
      androidVersion: string;
      apiLevel: string;
      screenSize: string;
      density: string;
    }> {
      const cacheKey = this.getShellKey(deviceId);
      const cached = this.deviceInfoCache.get(cacheKey);
      if (cached) return cached;
    
      const [model, manufacturer, androidVersion, apiLevel, sizeOutput, densityOutput] =
        await Promise.all([
          this.exec(["shell", "getprop", "ro.product.model"], deviceId),
          this.exec(["shell", "getprop", "ro.product.manufacturer"], deviceId),
          this.exec(["shell", "getprop", "ro.build.version.release"], deviceId),
          this.exec(["shell", "getprop", "ro.build.version.sdk"], deviceId),
          this.exec(["shell", "wm", "size"], deviceId),
          this.exec(["shell", "wm", "density"], deviceId),
        ]);
    
      const sizeMatch = sizeOutput.match(/(\d+x\d+)/);
      const densityMatch = densityOutput.match(/(\d+)/);
    
      const info = {
        model: model.trim(),
        manufacturer: manufacturer.trim(),
        androidVersion: androidVersion.trim(),
        apiLevel: apiLevel.trim(),
        screenSize: sizeMatch?.[1] ?? "unknown",
        density: densityMatch?.[1] ?? "unknown",
      };
    
      this.deviceInfoCache.set(cacheKey, info);
      return info;
    }
  • src/index.ts:552-571 (registration)
    Tool registration and MCP handler for 'get_device_info'.
    server.tool(
      "get_device_info",
      "Get device details: model, manufacturer, Android version, API level, screen size, and DPI.",
      { device_id: z.string().optional().describe("Device ID (optional if only one device)") },
      async ({ device_id }) => {
        const info = await adb.getDeviceInfo(device_id);
        return {
          content: [
            {
              type: "text",
              text: [
                `Model: ${info.manufacturer} ${info.model}`,
                `Android: ${info.androidVersion} (API ${info.apiLevel})`,
                `Screen: ${info.screenSize} @ ${info.density}dpi`,
              ].join("\n"),
            },
          ],
        };
      },
    );

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

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