adb_set_default_device
Set a specific Android device as the default for remote management operations, such as app control, file handling, or shell commands, using the ADB MCP Server.
Instructions
Set the default device for subsequent operations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | Yes | Device ID to set as default |
Implementation Reference
- src/tools/device.ts:57-81 (handler)The main handler function for the 'adb_set_default_device' tool. It validates the device connection, sets the default device via AdbClient, and returns a standardized success or error response.async setDefaultDevice(deviceId: string) { try { const connected = await this.adbClient.isDeviceConnected(deviceId); if (!connected) { return { success: false, error: 'Device not connected', message: 'Cannot set default device - device is not connected' }; } this.adbClient.setDefaultDevice(deviceId); return { success: true, data: { deviceId }, message: `Default device set to ${deviceId}` }; } catch (error: any) { return { success: false, error: error.message, message: 'Failed to set default device' }; } }
- src/index.ts:74-87 (schema)The tool schema definition including name, description, and input schema for 'adb_set_default_device', used in tool discovery (ListTools).{ name: 'adb_set_default_device', description: 'Set the default device for subsequent operations', inputSchema: { type: 'object', properties: { deviceId: { type: 'string', description: 'Device ID to set as default', }, }, required: ['deviceId'], }, },
- src/index.ts:437-438 (registration)Registration of the tool handler in the CallToolRequestSchema switch statement, delegating to DeviceTools.setDefaultDevice.case 'adb_set_default_device': return await this.handleToolCall(this.deviceTools.setDefaultDevice(args?.deviceId as string));
- src/adb-client.ts:125-127 (helper)Core helper method in AdbClient that stores the default device ID for use in subsequent ADB commands.setDefaultDevice(deviceId: string): void { this.defaultDevice = deviceId; }