Skip to main content
Glama

reorder_queue

Move a track to a different position in your Spotify queue to customize playback order.

Instructions

Reorder tracks in queue by moving a track to a different position
Args:
    range_start: Position of track to move
    insert_before: Position to insert the track

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
range_startYes
insert_beforeYes

Implementation Reference

  • main.py:199-208 (handler)
    MCP tool handler for 'reorder_queue', decorated with @mcp.tool(). Delegates to SpotifyClient.reorder_queue.
    @mcp.tool()
    async def reorder_queue(range_start: int, insert_before: int) -> str:
        """
        Reorder tracks in queue by moving a track to a different position
        Args:
            range_start: Position of track to move
            insert_before: Position to insert the track
        """
        return await client.reorder_queue(range_start, insert_before)
  • SpotifyClient method implementing the queue reordering logic using spotipy's queue_reorder.
    async def reorder_queue(self, range_start: int, insert_before: int) -> str:
        """
        Reorder tracks in queue by moving a track to a different position
        - range_start: Position of track to move (0-based)
        - insert_before: Position to insert the track (0-based)
        """
        try:
            # Note: Spotify's queue reordering is done through a special endpoint
            # that requires both positions to be 0-based
            self.sp.queue_reorder(
                range_start=range_start,
                insert_before=insert_before,
                range_length=1,  # Move one track at a time
            )
            return "Queue reordered successfully"
        except Exception as e:
            return f"Error reordering queue: {str(e)}"
  • main.py:199-199 (registration)
    The @mcp.tool() decorator registers the reorder_queue function as an MCP tool.
    @mcp.tool()

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