Skip to main content
Glama

adb_push_file

Transfer files from your computer to an Android device using the Android Debug Bridge (ADB). Specify local and remote file paths to move data to the device.

Instructions

Push a file from local system to device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
localPathYesLocal file path
remotePathYesRemote file path on device
deviceIdNoDevice ID (optional)

Implementation Reference

  • The main handler function for adb_push_file tool. Executes adb push command using AdbClient after checking device connection.
    async pushFile(localPath: string, remotePath: string, deviceId?: string) {
      try {
        const connected = await this.adbClient.isDeviceConnected(deviceId);
        if (!connected) {
          return {
            success: false,
            error: 'Device not connected',
            message: 'Cannot push file - device is not connected'
          };
        }
    
        const command = `push "${localPath}" "${remotePath}"`;
        const result = await this.adbClient.executeCommand(command, deviceId);
        
        if (!result.success) {
          return {
            success: false,
            error: result.error,
            message: 'Failed to push file'
          };
        }
    
        return {
          success: true,
          data: { 
            localPath,
            remotePath,
            deviceId: deviceId || this.adbClient.getDefaultDevice()
          },
          message: `File pushed from ${localPath} to ${remotePath}`
        };
      } catch (error: any) {
        return {
          success: false,
          error: error.message,
          message: 'Failed to push file'
        };
      }
    }
  • Tool schema definition including input schema for parameters: localPath (required), remotePath (required), deviceId (optional). Part of tool registration list.
    {
      name: 'adb_push_file',
      description: 'Push a file from local system to device',
      inputSchema: {
        type: 'object',
        properties: {
          localPath: {
            type: 'string',
            description: 'Local file path',
          },
          remotePath: {
            type: 'string',
            description: 'Remote file path on device',
          },
          deviceId: {
            type: 'string',
            description: 'Device ID (optional)',
          },
        },
        required: ['localPath', 'remotePath'],
      },
    },
  • src/index.ts:465-466 (registration)
    Registration in the tool dispatch switch statement, calling the FileTools.pushFile handler.
    case 'adb_push_file':
      return await this.handleToolCall(this.fileTools.pushFile(args?.localPath as string, args?.remotePath as string, args?.deviceId as string));

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

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