Skip to main content
Glama

add_to_queue

Add tracks to your Spotify playback queue for immediate or upcoming listening. Queue songs during events, build dynamic playlists, add discovery tracks without interrupting current playback, or create collaborative listening sessions.

Instructions

Add a specific track to the user's playback queue for immediate or upcoming playback.

🎯 USE CASES: β€’ Queue up requested songs during parties or events β€’ Build dynamic playlists on-the-fly based on mood β€’ Add discovery tracks without interrupting current playlist β€’ Create collaborative queuing for shared listening sessions β€’ Implement "play this next" functionality

πŸ“ WHAT IT RETURNS: β€’ Confirmation that track was added to queue β€’ Position of track in the upcoming queue β€’ Estimated time until track will play β€’ Current queue length and upcoming tracks preview β€’ Track information that was successfully queued

πŸ” EXAMPLES: β€’ "Add 'Bohemian Rhapsody' to my queue" β€’ "Queue up the track spotify:track:4uLU6hMCjMI75M1A2tKUQC" β€’ "Add this song to play next" β€’ "Put 'Sweet Child O Mine' in my queue"

🎡 QUEUE BEHAVIOR: β€’ Tracks play in the order they were added β€’ Queue plays after current track/playlist ends β€’ Maintains queue across device switches β€’ Can add multiple tracks for extended queuing β€’ Integrates with existing shuffle and repeat settings

⚠️ REQUIREMENTS: β€’ Valid Spotify access token with user-modify-playback-state scope β€’ Track must be available in user's market β€’ Active playback session or available device required

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
trackUriYesSpotify track URI (e.g., 'spotify:track:4uLU6hMCjMI75M1A2tKUQC')
deviceIdNoSpotify device ID (optional, uses active device if not specified)

Implementation Reference

  • MCP tool handler for 'add_to_queue' that validates args and calls SpotifyService.addToQueue
    handler: async (args: any, spotifyService: SpotifyService) => { const { token, trackUri, deviceId } = args; return await spotifyService.addToQueue(token, trackUri, deviceId); },
  • Input schema using Zod for token, trackUri (Spotify track URI), and deviceId
    schema: createSchema({ token: commonSchemas.token(), trackUri: z .string() .describe( "Spotify track URI (e.g., 'spotify:track:4uLU6hMCjMI75M1A2tKUQC')" ), deviceId: commonSchemas.deviceId(), }),
  • Registration of the 'add_to_queue' tool definition within the playbackTools object, including title, description, schema, and handler
    add_to_queue: { title: "Add Song to Queue", description: `Add a specific track to the user's playback queue for immediate or upcoming playback. 🎯 USE CASES: β€’ Queue up requested songs during parties or events β€’ Build dynamic playlists on-the-fly based on mood β€’ Add discovery tracks without interrupting current playlist β€’ Create collaborative queuing for shared listening sessions β€’ Implement "play this next" functionality πŸ“ WHAT IT RETURNS: β€’ Confirmation that track was added to queue β€’ Position of track in the upcoming queue β€’ Estimated time until track will play β€’ Current queue length and upcoming tracks preview β€’ Track information that was successfully queued πŸ” EXAMPLES: β€’ "Add 'Bohemian Rhapsody' to my queue" β€’ "Queue up the track spotify:track:4uLU6hMCjMI75M1A2tKUQC" β€’ "Add this song to play next" β€’ "Put 'Sweet Child O Mine' in my queue" 🎡 QUEUE BEHAVIOR: β€’ Tracks play in the order they were added β€’ Queue plays after current track/playlist ends β€’ Maintains queue across device switches β€’ Can add multiple tracks for extended queuing β€’ Integrates with existing shuffle and repeat settings ⚠️ REQUIREMENTS: β€’ Valid Spotify access token with user-modify-playback-state scope β€’ Track must be available in user's market β€’ Active playback session or available device required`, schema: createSchema({ token: commonSchemas.token(), trackUri: z .string() .describe( "Spotify track URI (e.g., 'spotify:track:4uLU6hMCjMI75M1A2tKUQC')" ), deviceId: commonSchemas.deviceId(), }), handler: async (args: any, spotifyService: SpotifyService) => { const { token, trackUri, deviceId } = args; return await spotifyService.addToQueue(token, trackUri, deviceId); }, },
  • SpotifyService helper method that performs the POST request to Spotify API endpoint /me/player/queue to add the track to queue
    async addToQueue( token: string, trackUri: string, deviceId: string | null = null ): Promise<void> { let endpoint = `me/player/queue?uri=${encodeURIComponent(trackUri)}`; if (deviceId) { endpoint += `&device_id=${deviceId}`; } return await this.makeRequest<void>(endpoint, token, {}, "POST"); }

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/latiftplgu/Spotify-OAuth-MCP-server'

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