adb_pull_file
Transfer files from Android devices to your local system using ADB commands. Specify remote file path and optional device ID or local destination.
Instructions
Pull a file from device to local system
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| remotePath | Yes | Remote file path on device | |
| localPath | No | Local file path (optional) | |
| deviceId | No | Device ID (optional) |
Implementation Reference
- src/tools/file.ts:47-85 (handler)The `pullFile` method in FileTools class executes the ADB `pull` command to transfer a file from the device to the local system. It checks device connection, determines local path if not provided, runs the command via AdbClient, and returns success/error details.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)The input schema definition for the 'adb_pull_file' tool, specifying parameters: remotePath (required), localPath (optional), deviceId (optional). This is part of the tool list returned by ListToolsRequest.{ 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)The switch case in the CallToolRequestHandler that registers and dispatches the 'adb_pull_file' tool call 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));