Skip to main content
Glama

get_devices

Retrieve all Spotify-connected devices for playback targeting and management. Shows available speakers, phones, TVs, and other devices with their current status and capabilities.

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

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication

Implementation Reference

  • The MCP tool handler for get_devices, extracting token and delegating to SpotifyService.getUserDevices
    handler: async (args: any, spotifyService: SpotifyService) => { const { token } = args; return await spotifyService.getUserDevices(token); },
  • Input schema definition for the get_devices tool, requiring a valid Spotify access token
    schema: createSchema({ token: commonSchemas.token(), }),
  • Full registration of the get_devices tool within the playbackTools object, including title, description, schema, and handler
    get_devices: { title: "Get User Devices", description: `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`, schema: createSchema({ token: commonSchemas.token(), }), handler: async (args: any, spotifyService: SpotifyService) => { const { token } = args; return await spotifyService.getUserDevices(token); }, },
  • SpotifyService helper method implementing the core logic by calling Spotify API endpoint /me/player/devices
    async getUserDevices(token: string): Promise<{ devices: SpotifyDevice[] }> { return await this.makeRequest<{ devices: SpotifyDevice[] }>( "me/player/devices", token ); }
  • TypeScript interface defining the structure of SpotifyDevice objects returned by the tool
    export interface SpotifyDevice { id: string; is_active: boolean; is_private_session: boolean; is_restricted: boolean; name: string; type: string; volume_percent: number | null; }

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/latiftplgu/Spotify-OAuth-MCP-server'

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