Skip to main content
Glama
rahulkr
by rahulkr

install_apk

Install APK files on Android devices through ADB commands for app deployment, testing, and development workflows.

Instructions

Install an APK file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apk_pathYes
device_serialNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function implementing the 'install_apk' MCP tool. It uses the run_adb helper to execute 'adb install -r' on the specified APK path, optionally targeting a specific device serial. The @mcp.tool() decorator registers it as an MCP tool.
    @mcp.tool()
    def install_apk(apk_path: str, device_serial: str | None = None) -> str:
        """Install an APK file"""
        return run_adb(["install", "-r", apk_path], device_serial)
  • Supporting helper function that executes arbitrary ADB commands via subprocess.run(). Handles device targeting with -s flag, captures output/errors, and manages timeouts. Directly called by the install_apk handler.
    def run_adb(args: list[str], device_serial: str | None = None, timeout: int = 30) -> str:
        """Run an ADB command and return output"""
        cmd = ["adb"]
        if device_serial:
            cmd.extend(["-s", device_serial])
        cmd.extend(args)
        
        try:
            result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
            if result.returncode != 0 and result.stderr:
                return f"Error: {result.stderr}"
            return result.stdout
        except subprocess.TimeoutExpired:
            return "Error: Command timed out"
        except Exception as e:
            return f"Error: {str(e)}"
  • Creation of the FastMCP server instance named 'adb-dev-server'. All @mcp.tool() decorated functions, including install_apk, are automatically registered with this server instance. The server is run via mcp.run() at the end of the file.
    mcp = FastMCP("adb-dev-server")
Behavior1/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 but offers no details. It doesn't mention whether this requires device permissions, if it overwrites existing apps, potential side effects (e.g., data loss), or error conditions. This is inadequate 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 extremely concise with a single sentence that directly states the tool's function. It's front-loaded with the core action and resource, with no wasted words or 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, 0% schema coverage, and an output schema (which helps but isn't described), the description is incomplete. It lacks critical context about behavior, parameters, and usage scenarios, making it insufficient for safe and effective tool invocation.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but adds no parameter information. It doesn't explain what 'apk_path' represents (e.g., local file path, URL) or when 'device_serial' is needed (e.g., for multi-device setups). The description fails to provide meaning beyond the bare schema.

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 'Install an APK file' clearly states the action (install) and resource (APK file), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'push_file' or 'uninstall_app' that might handle APK files differently, preventing a perfect 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. It doesn't mention prerequisites (e.g., device connectivity), when to choose this over other installation methods, or exclusions (e.g., incompatible APK types). This leaves the agent without context for tool 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/rahulkr/r_adb_mcp_server'

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