Skip to main content
Glama

get_device_info

Retrieve detailed Android device specifications including model, Android version, SDK version, screen size, brand, and manufacturer for connected devices.

Instructions

Get detailed information about a connected Android device including model, Android version, SDK version, screen size, brand, and manufacturer

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idNoDevice serial number. If omitted, uses the only connected device.

Implementation Reference

  • The core logic for gathering device information using ADB shell commands.
    async getDeviceInfo(deviceId?: string): Promise<DeviceInfo> {
      const resolvedId = await this.resolveDeviceId(deviceId);
    
      const [modelResult, versionResult, sdkResult, sizeResult, brandResult, mfgResult] = await Promise.all([
        adbShell(['getprop', 'ro.product.model'], resolvedId),
        adbShell(['getprop', 'ro.build.version.release'], resolvedId),
        adbShell(['getprop', 'ro.build.version.sdk'], resolvedId),
        adbShell(['wm', 'size'], resolvedId),
        adbShell(['getprop', 'ro.product.brand'], resolvedId),
        adbShell(['getprop', 'ro.product.manufacturer'], resolvedId),
      ]);
    
      // Parse screen size: "Physical size: 1080x1920"
      const sizeMatch = sizeResult.stdout.match(/(\d+)x(\d+)/);
      const screenWidth = sizeMatch ? parseInt(sizeMatch[1], 10) : undefined;
      const screenHeight = sizeMatch ? parseInt(sizeMatch[2], 10) : undefined;
    
      const info: DeviceInfo = {
        id: resolvedId,
        status: 'device',
        model: modelResult.stdout.trim(),
        androidVersion: versionResult.stdout.trim(),
        sdkVersion: sdkResult.stdout.trim(),
        screenWidth,
        screenHeight,
        brand: brandResult.stdout.trim(),
        manufacturer: mfgResult.stdout.trim(),
      };
    
      // Cache screen size in session
      if (screenWidth && screenHeight) {
        this.updateSession(resolvedId, screenWidth, screenHeight);
      }
    
      return info;
    }
  • Registration of the 'get_device_info' MCP tool, which invokes the DeviceManager handler.
    server.registerTool(
      'get_device_info',
      {
        description: 'Get detailed information about a connected Android device including model, Android version, SDK version, screen size, brand, and manufacturer',
        inputSchema: {
          device_id: z.string().optional().describe('Device serial number. If omitted, uses the only connected device.'),
        },
      },
      async ({ device_id }) => {
        return await metrics.measure('get_device_info', device_id || 'default', async () => {
          const info = await deviceManager.getDeviceInfo(device_id);
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify({ success: true, device: info }, null, 2),
            }],
          };
        });
      }
    );

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