Skip to main content
Glama

spotify_play_playlist

Play a specific Spotify playlist by providing its ID to start music playback on your preferred device.

Instructions

Toca uma playlist específica

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idNoID do dispositivo (opcional)
playlist_idYesID da playlist no Spotify

Implementation Reference

  • The handler function that executes the logic to play a specific Spotify playlist using the Spotify API's play method with context_uri.
    async playPlaylist(playlistId: string, deviceId?: string) { try { await this.spotifyAuth.ensureValidToken(); const spotifyApi = this.spotifyAuth.getSpotifyApi(); const options: any = { context_uri: `spotify:playlist:${playlistId}` }; if (deviceId) { options.device_id = deviceId; } await spotifyApi.play(options); return { content: [ { type: 'text', text: `▶️ Tocando playlist com ID: ${playlistId}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `❌ Erro ao tocar playlist: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }
  • Input schema definition for the spotify_play_playlist tool, specifying parameters playlist_id (required) and optional device_id.
    { name: 'spotify_play_playlist', description: 'Toca uma playlist específica', inputSchema: { type: 'object', properties: { playlist_id: { type: 'string', description: 'ID da playlist no Spotify', }, device_id: { type: 'string', description: 'ID do dispositivo (opcional)', }, }, required: ['playlist_id'], }, },
  • src/index.ts:295-296 (registration)
    Registration in the CallToolRequest handler switch statement, dispatching to the playPlaylist method on SpotifyTools instance.
    case 'spotify_play_playlist': return await spotifyTools.playPlaylist(args.playlist_id, args.device_id);

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/fborello/MCPSpotify'

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