Skip to main content
Glama

adb_install

Install APK files on Android devices using ADB commands. Specify the APK path and optional device ID to deploy applications directly from your computer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apkPathYesLocal path to the APK file
deviceNoSpecific device ID (optional)

Implementation Reference

  • The main handler function that executes the ADB install command with the provided APK path on the specified device, handling errors and logging.
    async (args: z.infer<typeof AdbInstallSchema>, _extra: RequestHandlerExtra) => {
      log(LogLevel.INFO, `Installing APK file from path: ${args.apkPath}`);
      
      try {
        // Install the APK using the provided file path
        const deviceArgs = buildDeviceArgs(args.device);
        const apkPath = args.apkPath.trim();
        if (!apkPath) {
          throw new Error("APK path must not be empty");
        }
    
        const result = await executeAdbCommand([...deviceArgs, "install", "-r", apkPath], "Error installing APK");
        if (!result.isError) {
          log(LogLevel.INFO, "APK installed successfully");
        }
        return result;
      } catch (error) {
        const errorMsg = error instanceof Error ? error.message : String(error);
        log(LogLevel.ERROR, `Error installing APK: ${errorMsg}`);
        return {
          content: [{ type: "text" as const, text: `Error installing APK: ${errorMsg}` }],
          isError: true
        };
      }
    },
  • src/index.ts:501-530 (registration)
    Registers the 'adb_install' tool with the MCP server, specifying the tool name, input schema, handler function, and description.
    server.tool(
      "adb_install",
      AdbInstallSchema.shape,
      async (args: z.infer<typeof AdbInstallSchema>, _extra: RequestHandlerExtra) => {
        log(LogLevel.INFO, `Installing APK file from path: ${args.apkPath}`);
        
        try {
          // Install the APK using the provided file path
          const deviceArgs = buildDeviceArgs(args.device);
          const apkPath = args.apkPath.trim();
          if (!apkPath) {
            throw new Error("APK path must not be empty");
          }
    
          const result = await executeAdbCommand([...deviceArgs, "install", "-r", apkPath], "Error installing APK");
          if (!result.isError) {
            log(LogLevel.INFO, "APK installed successfully");
          }
          return result;
        } catch (error) {
          const errorMsg = error instanceof Error ? error.message : String(error);
          log(LogLevel.ERROR, `Error installing APK: ${errorMsg}`);
          return {
            content: [{ type: "text" as const, text: `Error installing APK: ${errorMsg}` }],
            isError: true
          };
        }
      },
      { description: ADB_INSTALL_TOOL_DESCRIPTION }
    );
  • Zod input schema definition for the adb_install tool parameters: apkPath and optional device.
    export const adbInstallInputSchema = {
      apkPath: z.string().describe("Local path to the APK file"),
      device: z.string().optional().describe("Specific device ID (optional)")
    };
  • Creates the full Zod schema object for AdbInstall by wrapping the input schema.
    export const AdbInstallSchema = z.object(adbInstallInputSchema);
  • Tool description string used in the registration of the adb_install tool.
    const ADB_INSTALL_TOOL_DESCRIPTION = 
      "Installs an Android application (APK) on a connected device or emulator. " +
      "Use this for deploying applications, testing new builds, or updating existing apps. " +
      "Provide the local path to the APK file for installation. " +
      "Automatically handles the installation process, including replacing existing versions. " +
      "Specify a device ID when working with multiple connected devices.";
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

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/srmorete/adb-mcp'

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