Skip to main content
Glama
zillow
by zillow

installApp

Install APK files on Android devices for mobile app testing and automation workflows.

Instructions

Install an APK file on the device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apkPathYesPath to the APK file to install

Implementation Reference

  • The registered tool handler for 'installApp'. It instantiates the InstallApp class and calls its execute method with the provided APK path, handling errors and formatting the response.
    const installAppHandler = async (device: BootedDevice, args: InstallAppArgs) => {
      try {
        const installApp = new InstallApp(device);
        const result = await installApp.execute(args.apkPath);
    
        return createJSONToolResponse({
          message: `Installed app from ${args.apkPath}`,
          ...result
        });
      } catch (error) {
        throw new ActionableError(`Failed to install app: ${error}`);
      }
    };
  • Core logic for installing the APK: resolves path, extracts package name using aapt dump, checks if already installed, installs with adb install -r, determines success and if it was an upgrade.
    async execute(apkPath: string): Promise<{ success: boolean; upgrade: boolean }> {
      if (!path.isAbsolute(apkPath)) {
        apkPath = path.resolve(process.cwd(), apkPath);
      }
    
      // Extract package name from APK
      const packageNameCmd = `dump badging "${apkPath}" | grep "package:" | grep -o "name='[^']*'" | cut -d= -f2 | tr -d "'"`;
      const packageName = await this.adb.executeCommand(packageNameCmd);
    
      // Check if app is already installed
      const isInstalledCmd = `shell pm list packages -f ${packageName.trim()} | grep -c ${packageName.trim()}`;
      const isInstalledOutput = await this.adb.executeCommand(isInstalledCmd, undefined, undefined, true);
      const isInstalled = parseInt(isInstalledOutput.trim(), 10) > 0;
    
      const installOutput = await this.adb.executeCommand(`install -r "${apkPath}"`);
      const success = installOutput.includes("Success");
    
      return {
        success: success,
        upgrade: isInstalled && success
      };
    }
  • Zod input schema for the installApp tool, validating the apkPath parameter.
    export const installAppSchema = z.object({
      apkPath: z.string().describe("Path to the APK file to install"),
    });
  • Registers the installApp tool with the ToolRegistry using the name, description, input schema, and handler function.
    ToolRegistry.registerDeviceAware(
      "installApp",
      "Install an APK file on the device",
      installAppSchema,
      installAppHandler
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions installation but lacks details on permissions required, whether it overwrites existing apps, error handling, or side effects. This is insufficient for a mutation tool with zero annotation coverage.

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, direct sentence with no wasted words, making it highly concise and front-loaded. It efficiently communicates the core action without unnecessary elaboration.

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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects like success/failure outcomes, dependencies, or device requirements, leaving significant gaps for an agent to use it effectively.

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

Parameters3/5

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

The input schema has 100% description coverage, fully documenting the 'apkPath' parameter. The description adds no additional semantic context beyond what the schema provides, such as file format specifics or path examples, so it meets the baseline for high schema coverage.

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 ('install') and target resource ('an APK file on the device'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'installPlatformDependencies' or 'setAppSource', which could provide similar functionality, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'installPlatformDependencies' or 'setAppSource', nor does it mention prerequisites such as device state or permissions. It simply states what the tool does without context for selection.

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/zillow/auto-mobile'

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