Skip to main content
Glama

get_devices

Retrieve available Spotify playback devices and identify the current default device for controlling music across connected speakers, phones, or computers.

Instructions

Get list of available Spotify devices and the current default device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler logic for the 'get_devices' tool in the CallToolRequestHandler switch statement. Fetches devices using SpotifyClient and returns them along with the current default device.
    case 'get_devices': const devices = await client.getDevices(); return { content: [ { type: 'text', text: JSON.stringify({ success: true, devices, defaultDevice: deviceManager.getDefaultDevice(), }, null, 2), }, ], };
  • src/server.ts:213-220 (registration)
    Registration of the 'get_devices' tool in the ListToolsRequestHandler, including name, description, and empty input schema.
    { name: 'get_devices', description: 'Get list of available Spotify devices and the current default device', inputSchema: { type: 'object', properties: {}, }, },
  • Implementation of getDevices method in SpotifyClient class, which queries the Spotify API for available devices and maps the response.
    async getDevices() { const api = await this.getApi(); const data = await api.getMyDevices(); return data.body.devices.map((device: any) => ({ id: device.id, name: device.name, type: device.type, isActive: device.is_active, volumePercent: device.volume_percent || 0, })); }

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/Ackberry/spotify_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server