Skip to main content
Glama

adb_push

Push files from your computer to an Android device using ADB commands. Specify the file content and destination path to transfer files to the device.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileBase64YesBase64 encoded file content to push
remotePathYesRemote file path on the device
deviceNoSpecific device ID (optional)

Implementation Reference

  • The core handler function for the 'adb_push' tool. It decodes the base64-encoded file input, writes it to a temporary local file, executes the 'adb push' command to transfer it to the specified remote path on the device (optionally targeting a specific device), handles the result or errors, and cleans up the temporary file.
    async (args: z.infer<typeof AdbPushSchema>, _extra: RequestHandlerExtra) => {
      log(LogLevel.INFO, `Pushing file to device: ${args.remotePath}`);
      
      const deviceArgs = buildDeviceArgs(args.device);
      const tempFilePath = createTempFilePath("adb-mcp", basename(args.remotePath));
      
      try {
        // Decode the base64 file data and write to temporary file
        const fileData = Buffer.from(args.fileBase64, 'base64');
        await writeFilePromise(tempFilePath, fileData);
        
        // Push the temporary file to the device
        const remotePath = args.remotePath.trim();
        if (!remotePath) {
          throw new Error("Remote path must not be empty");
        }
    
        const result = await executeAdbCommand([...deviceArgs, "push", tempFilePath, remotePath], "Error pushing file");
        if (!result.isError) {
          log(LogLevel.INFO, `File pushed to device successfully: ${remotePath}`);
        }
        return result;
        
      } catch (error) {
        const errorMsg = error instanceof Error ? error.message : String(error);
        log(LogLevel.ERROR, `Error pushing file: ${errorMsg}`);
        return {
          content: [{ type: "text" as const, text: `Error pushing file: ${errorMsg}` }],
          isError: true
        };
      } finally {
        // Clean up the temporary file
        await cleanupTempFile(tempFilePath);
      }
    },
  • Zod schema fields defining the input parameters for the adb_push tool: base64 file content, destination path on device, and optional device ID.
    export const adbPushInputSchema = {
      fileBase64: z.string().describe("Base64 encoded file content to push"),
      remotePath: z.string().describe("Remote file path on the device"),
      device: z.string().optional().describe("Specific device ID (optional)")
    };
  • Zod schema object construction for adb_push tool input validation using the defined input fields.
    export const AdbPushSchema = z.object(adbPushInputSchema);
  • src/index.ts:624-662 (registration)
    Registration of the 'adb_push' tool with the MCP server, specifying the tool name, input schema shape, inline handler function, and tool description.
    server.tool(
      "adb_push",
      AdbPushSchema.shape,
      async (args: z.infer<typeof AdbPushSchema>, _extra: RequestHandlerExtra) => {
        log(LogLevel.INFO, `Pushing file to device: ${args.remotePath}`);
        
        const deviceArgs = buildDeviceArgs(args.device);
        const tempFilePath = createTempFilePath("adb-mcp", basename(args.remotePath));
        
        try {
          // Decode the base64 file data and write to temporary file
          const fileData = Buffer.from(args.fileBase64, 'base64');
          await writeFilePromise(tempFilePath, fileData);
          
          // Push the temporary file to the device
          const remotePath = args.remotePath.trim();
          if (!remotePath) {
            throw new Error("Remote path must not be empty");
          }
    
          const result = await executeAdbCommand([...deviceArgs, "push", tempFilePath, remotePath], "Error pushing file");
          if (!result.isError) {
            log(LogLevel.INFO, `File pushed to device successfully: ${remotePath}`);
          }
          return result;
          
        } catch (error) {
          const errorMsg = error instanceof Error ? error.message : String(error);
          log(LogLevel.ERROR, `Error pushing file: ${errorMsg}`);
          return {
            content: [{ type: "text" as const, text: `Error pushing file: ${errorMsg}` }],
            isError: true
          };
        } finally {
          // Clean up the temporary file
          await cleanupTempFile(tempFilePath);
        }
      },
      { description: ADB_PUSH_TOOL_DESCRIPTION }
  • Detailed description string for the adb_push tool, used during registration to inform clients about its purpose and usage.
     * Tool description for adb-push
     */
    const ADB_PUSH_TOOL_DESCRIPTION = 
      "Transfers a file from the server to a connected Android device. " +
      "Useful for uploading test data, configuration files, media content, or any file needed on the device. " +
      "The file must be provided as base64-encoded content. " +
      "Requires specifying the full destination path on the device where the file should be placed. " +
      "Use this when setting up test environments, restoring backups, or modifying device files.";
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