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");
    }
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure and excels at it. The 'QUEUE BEHAVIOR' section details how tracks are ordered, when they play, and integration with shuffle/repeat settings. The 'WHAT IT RETURNS' section describes the response format, and 'REQUIREMENTS' covers authentication needs and constraints like market availability.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (USE CASES, WHAT IT RETURNS, etc.) and front-loaded with the core purpose. While comprehensive, some sections could be more concise (e.g., USE CASES has 5 bullet points where 3 might suffice), but overall it's efficient with minimal redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 3-parameter tool with no annotations and no output schema, the description provides exceptional completeness. It covers purpose, usage scenarios, return values, behavioral details, examples, and requirements - giving the agent everything needed to understand when and how to use this tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds value by explaining the purpose of trackUri through examples ('spotify:track:4uLU6hMCjMI75M1A2tKUQC') and clarifying deviceId behavior ('uses active device if not specified') in the requirements section, though it doesn't explicitly map all parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Add a specific track to the user's playback queue') and distinguishes it from sibling tools like 'add_to_playlist' or 'create_playlist' by focusing on immediate/upcoming playback rather than playlist management. The verb+resource combination is precise and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The 'USE CASES' section provides explicit guidance on when to use this tool (e.g., 'Queue up requested songs during parties', 'Add discovery tracks without interrupting current playlist'), and the 'REQUIREMENTS' section clearly states prerequisites like active playback session and valid access token. It implicitly distinguishes from playlist tools by focusing on temporary queue management.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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