Skip to main content
Glama

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
NameRequiredDescriptionDefault
deviceIdYesDevice ID to set as default

Implementation Reference

  • 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' }; } }
  • 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));
  • Core helper method in AdbClient that stores the default device ID for use in subsequent ADB commands.
    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