Skip to main content
Glama

adb_push_file

Transfer files from a local system to an Android device using Android Debug Bridge. Specify local and remote file paths, with optional device ID for targeted operations.

Instructions

Push a file from local system to device

Input Schema

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

Implementation Reference

  • Implements the core logic for the 'adb_push_file' tool by executing the ADB 'push' command via AdbClient after verifying 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' }; } }
  • Defines the input schema for the 'adb_push_file' tool, specifying parameters localPath, remotePath (required), and optional deviceId.
    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)
    Registers the handler for 'adb_push_file' tool call by dispatching to FileTools.pushFile method.
    case 'adb_push_file': return await this.handleToolCall(this.fileTools.pushFile(args?.localPath as string, args?.remotePath as string, args?.deviceId as string));
  • src/index.ts:292-313 (registration)
    Registers the 'adb_push_file' tool in the listTools response, including name, description, and input schema.
    { 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'], }, },

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