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
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | No | Device ID (optional) | |
| localPath | Yes | Local file path | |
| remotePath | Yes | Remote file path on device |
Implementation Reference
- src/tools/file.ts:7-45 (handler)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' }; } }
- src/index.ts:295-311 (schema)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'], }, },