Skip to main content
Glama

add_to_queue

Add a Spotify track to your playback queue using its track ID. This tool lets you queue songs for continuous listening without interrupting current playback.

Instructions

Add a track to the playback queue.

Args: track_id: Spotify track ID to add to queue Returns: Dict with status and message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
track_idYes

Implementation Reference

  • The core handler function for the 'add_to_queue' MCP tool. Decorated with @mcp.tool() for automatic registration in FastMCP. Takes a track_id parameter, formats it as a Spotify URI, and calls the underlying spotipy client's add_to_queue method. Returns a success message or raises an error.
    @mcp.tool() @log_tool_execution def add_to_queue(track_id: str) -> dict[str, str]: """Add a track to the playback queue. Args: track_id: Spotify track ID to add to queue Returns: Dict with status and message """ try: logger.info(f"🎵 Adding track {track_id} to queue") spotify_client.add_to_queue(f"spotify:track:{track_id}") return {"status": "success", "message": "Added track to queue"} except SpotifyException as e: raise convert_spotify_error(e) from e
  • The @mcp.tool() decorator registers the add_to_queue function as an MCP tool in the FastMCP server. The @log_tool_execution decorator adds logging.
    @mcp.tool()
  • Supporting method in the SpotifyClient wrapper class that wraps spotipy's add_to_queue. Although not directly called by the tool handler (which uses the raw spotipy client), it provides a similar interface for adding tracks to the queue.
    def add_to_queue(self, track_id: str, device: dict[str, Any] | None = None) -> None: """ Adds track to queue. - track_id: ID of track to play. """ self.sp.add_to_queue(track_id, device.get("id") if device else None)

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

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