adb_pull_file
Use this tool to transfer files from an Android device to a local system by specifying the remote file path. Optionally, provide a local path and device ID for precise file management.
Instructions
Pull a file from device to local system
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | No | Device ID (optional) | |
| localPath | No | Local file path (optional) | |
| remotePath | Yes | Remote file path on device |
Implementation Reference
- src/tools/file.ts:47-85 (handler)The `pullFile` method in FileTools class that executes the ADB pull command to retrieve a file from the device.async pullFile(remotePath: string, localPath?: string, deviceId?: string) { try { const connected = await this.adbClient.isDeviceConnected(deviceId); if (!connected) { return { success: false, error: 'Device not connected', message: 'Cannot pull file - device is not connected' }; } const finalLocalPath = localPath || path.join(process.cwd(), path.basename(remotePath)); const command = `pull "${remotePath}" "${finalLocalPath}"`; const result = await this.adbClient.executeCommand(command, deviceId); if (!result.success) { return { success: false, error: result.error, message: 'Failed to pull file' }; } return { success: true, data: { remotePath, localPath: finalLocalPath, deviceId: deviceId || this.adbClient.getDefaultDevice() }, message: `File pulled from ${remotePath} to ${finalLocalPath}` }; } catch (error: any) { return { success: false, error: error.message, message: 'Failed to pull file' }; }
- src/index.ts:314-335 (schema)Input schema definition for the `adb_pull_file` tool, specifying parameters like remotePath, localPath, and deviceId.{ name: 'adb_pull_file', description: 'Pull a file from device to local system', inputSchema: { type: 'object', properties: { remotePath: { type: 'string', description: 'Remote file path on device', }, localPath: { type: 'string', description: 'Local file path (optional)', }, deviceId: { type: 'string', description: 'Device ID (optional)', }, }, required: ['remotePath'], }, },
- src/index.ts:467-468 (registration)Dispatch handler in the switch statement that routes `adb_pull_file` tool calls to the `fileTools.pullFile` method.case 'adb_pull_file': return await this.handleToolCall(this.fileTools.pullFile(args?.remotePath as string, args?.localPath as string, args?.deviceId as string));