add_to_queue
Add a Spotify track to your playback queue using its track ID to control music flow during listening sessions.
Instructions
Add a track to the queue
Args:
track_id: Spotify track ID to add
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| track_id | Yes |
Implementation Reference
- spotify.py:233-242 (handler)Core handler function in SpotifyClient that adds a track to the Spotify playback queue by calling the Spotify API.async def add_to_queue(self, track_id: str) -> str: """ Add a track to the user's queue. - track_id: Spotify track ID to add """ try: self.sp.add_to_queue(uri=f"spotify:track:{track_id}") return "Track added to queue successfully" except Exception as e: return f"Error adding track to queue: {str(e)}"
- main.py:129-136 (registration)MCP tool registration using @mcp.tool() decorator. This thin wrapper delegates to the SpotifyClient handler and defines the tool schema via signature and docstring.@mcp.tool() async def add_to_queue(track_id: str) -> str: """ Add a track to the queue Args: track_id: Spotify track ID to add """ return await client.add_to_queue(track_id)