get_devices
Retrieve a list of Spotify-connected devices, including names, types, active status, and capabilities, to manage playback targeting, monitor availability, or integrate with smart home systems.
Instructions
Retrieve all available Spotify-connected devices for the user's account.
🎯 USE CASES: • Display device options for playback targeting • Build device management and control interfaces • Check which devices are currently online and available • Monitor device battery levels and connection status • Create smart home integrations with Spotify-enabled devices
📝 WHAT IT RETURNS: • Complete list of user's connected devices • Device names, types, and unique identifiers • Current active state and availability status • Volume levels and playback capabilities • Device restrictions and supported features
🔍 EXAMPLES: • "Show me all my Spotify devices" • "What devices can I play music on?" • "List my available speakers and phones" • "Which devices are currently online?"
🔧 DEVICE TYPES: • Computer (desktop/laptop applications) • Smartphone (mobile apps) • Speaker (smart speakers, soundbars) • TV (smart TVs, streaming devices) • Car (automotive systems) • Game Console (PlayStation, Xbox)
💡 DEVICE MANAGEMENT: • Shows real-time availability status • Indicates which device is currently active • Displays volume control capabilities • Shows device-specific restrictions • Perfect for building device selector UIs
⚠️ REQUIREMENTS: • Valid Spotify access token with user-read-playback-state scope • At least one Spotify-enabled device must be logged in
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Spotify access token for authentication |
Implementation Reference
- src/mcp/tools/playback.ts:438-441 (handler)Handler function for the get_devices MCP tool. Extracts the access token from arguments and delegates to SpotifyService.getUserDevices(token).handler: async (args: any, spotifyService: SpotifyService) => { const { token } = args; return await spotifyService.getUserDevices(token); },
- src/spotify.ts:707-712 (helper)Core implementation of device retrieval in SpotifyService class. Makes authenticated GET request to Spotify API endpoint 'me/player/devices' to fetch user's available playback devices.async getUserDevices(token: string): Promise<{ devices: SpotifyDevice[] }> { return await this.makeRequest<{ devices: SpotifyDevice[] }>( "me/player/devices", token ); }
- src/mcp/tools/playback.ts:435-437 (schema)Input schema validation for get_devices tool using Zod. Requires a valid Spotify access token.schema: createSchema({ token: commonSchemas.token(), }),
- src/spotify.ts:114-122 (schema)TypeScript interface defining the structure of individual Spotify devices returned by the get_devices tool.export interface SpotifyDevice { id: string; is_active: boolean; is_private_session: boolean; is_restricted: boolean; name: string; type: string; volume_percent: number | null; }
- src/mcp/tools/index.ts:22-36 (registration)Central tools registry where playbackTools (containing get_devices) is spread into allTools, making it available to ToolRegistrar for MCP server registration.export const allTools: ToolsRegistry = { ...albumTools, ...artistTools, ...trackTools, ...playlistTools, ...playbackTools, ...userTools, ...searchTools, };