Skip to main content
Glama

install_apk

Install APK files from local storage onto Android devices using ADB commands. Specify the file path and optionally target a specific device by serial number.

Instructions

Install an APK file onto the Android device from a local file path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
local_pathYesLocal filesystem path to the APK file
device_idNoDevice serial number

Implementation Reference

  • The core function that executes the ADB install command.
    export async function installApk(localPath: string, deviceId?: string): Promise<string> {
      const resolved = await deviceManager.resolveDeviceId(deviceId);
      validateLocalPath(localPath);
    
      const result = await adbExec(['install', '-r', localPath], resolved, 120000);
    
      if (result.stdout.includes('Success')) {
        log.info('APK installed', { localPath, deviceId: resolved });
        return `Successfully installed: ${localPath}`;
      }
    
      throw new Error(`APK installation failed: ${result.stdout} ${result.stderr}`);
    }
  • Registration of the install_apk tool within the MCP server.
    server.registerTool(
      'install_apk',
      {
        description: 'Install an APK file onto the Android device from a local file path.',
        inputSchema: {
          local_path: z.string().describe('Local filesystem path to the APK file'),
          device_id: z.string().optional().describe('Device serial number'),
        },
      },
      async ({ local_path, device_id }) => {
        return await metrics.measure('install_apk', device_id || 'default', async () => {
          const result = await installApk(local_path, device_id);
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify({ success: true, message: result }, 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