Skip to main content
Glama

adb_set_default_device

Set the default Android device for ADB operations to streamline device management and automation tasks.

Instructions

Set the default device for subsequent operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdYesDevice ID to set as default

Implementation Reference

  • The primary handler function for the 'adb_set_default_device' tool. It checks if the specified device is connected, sets it as the default using AdbClient, and returns a structured 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' }; } }
  • Input schema definition for the tool, specifying that 'deviceId' is required.
    { 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)
    Registers the tool handler in the switch statement for CallToolRequestSchema, delegating to deviceTools.setDefaultDevice.
    case 'adb_set_default_device': return await this.handleToolCall(this.deviceTools.setDefaultDevice(args?.deviceId as string));
  • Helper method in AdbClient that sets the defaultDevice property, used by all subsequent ADB commands to target the correct device.
    setDefaultDevice(deviceId: string): void { this.defaultDevice = deviceId; }

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