Skip to main content
Glama

start_playlist_playback

Play a Spotify playlist by providing its ID, optionally specifying a device for playback.

Instructions

Start playback of a specific playlist Args: playlist_id: Spotify playlist ID device_id: Optional device to play on

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlist_idYes
device_idNo

Implementation Reference

  • main.py:155-166 (handler)
    The main handler function for the MCP tool 'start_playlist_playback'. It is registered via the @mcp.tool() decorator and handles starting playback of a specified Spotify playlist by constructing the context URI and calling the SpotifyClient helper method.
    @mcp.tool() async def start_playlist_playback(playlist_id: str, device_id: str = None) -> str: """ Start playback of a specific playlist Args: playlist_id: Spotify playlist ID device_id: Optional device to play on """ return await client.start_context_playback( f"spotify:playlist:{playlist_id}", device_id )
  • Helper method in the SpotifyClient class that performs the actual Spotify API call to start playback of a context URI (such as a playlist), used by the MCP tool handler.
    async def start_context_playback( self, context_uri: str, device_id: Optional[str] = None ) -> str: """ Start playback of a context (playlist, album, artist) - context_uri: Spotify URI (e.g. 'spotify:playlist:37i9dQ...') - device_id: Optional device to play on """ try: self.sp.start_playback(device_id=device_id, context_uri=context_uri) return "Started playing context successfully" except Exception as e: return f"Error starting context playback: {str(e)}"

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/ashwanth1109/mcp-spotify'

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