Skip to main content
Glama

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
NameRequiredDescriptionDefault
remotePathYesRemote file path on device
localPathNoLocal file path (optional)
deviceIdNoDevice ID (optional)

Implementation Reference

  • 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' }; }
  • 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));

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