Skip to main content
Glama
makesh-kumar

Spotify MCP Server

by makesh-kumar

addToQueue

Add tracks, albums, artists, or playlists to your Spotify playback queue using Spotify URIs or IDs. Control playback by specifying device targets.

Instructions

Adds a track, album, artist or playlist to the playback queue

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uriNoThe Spotify URI to play (overrides type and id)
typeNoThe type of item to play
idNoThe Spotify ID of the item to play
deviceIdNoThe Spotify device ID to add the track to

Implementation Reference

  • Handler function that destructures args, constructs Spotify URI from type/id if uri not provided, validates presence of uri, uses handleSpotifyRequest to call Spotify API's addItemToPlaybackQueue, and returns success message.
    handler: async (args) => {
      const { uri, type, id, deviceId } = args;
    
      let spotifyUri = uri;
      if (!spotifyUri && type && id) {
        spotifyUri = `spotify:${type}:${id}`;
      }
    
      if (!spotifyUri) {
        return {
          content: [
            {
              type: 'text',
              text: 'Error: Must provide either a URI or both a type and ID',
              isError: true,
            },
          ],
        };
      }
    
      await handleSpotifyRequest(async (spotifyApi) => {
        await spotifyApi.player.addItemToPlaybackQueue(
          spotifyUri,
          deviceId || '',
        );
      });
    
      return {
        content: [
          {
            type: 'text',
            text: `Added item ${spotifyUri} to queue`,
          },
        ],
      };
    },
  • Zod input schema for addToQueue tool defining optional parameters: uri (Spotify URI), type (track/album/artist/playlist), id (Spotify ID), deviceId (target device).
    schema: {
      uri: z
        .string()
        .optional()
        .describe('The Spotify URI to play (overrides type and id)'),
      type: z
        .enum(['track', 'album', 'artist', 'playlist'])
        .optional()
        .describe('The type of item to play'),
      id: z.string().optional().describe('The Spotify ID of the item to play'),
      deviceId: z
        .string()
        .optional()
        .describe('The Spotify device ID to add the track to'),
    },
  • src/index.ts:12-14 (registration)
    Registers all tools from readTools, playTools (which includes addToQueue), and albumTools by spreading the arrays and calling server.tool() with name, description, schema, and handler for each.
    [...readTools, ...playTools, ...albumTools].forEach((tool) => {
      server.tool(tool.name, tool.description, tool.schema, tool.handler);
    });
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the action ('Adds') but does not specify whether this requires an active device, affects current playback, has rate limits, or what happens on success/failure. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core action and resources without unnecessary words. Every part earns its place by clearly stating the tool's function, making it appropriately sized and well-structured.

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

Completeness2/5

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

Given the complexity of a mutation tool with no annotations and no output schema, the description is incomplete. It fails to address key contextual aspects like behavioral traits (e.g., permissions, side effects) or return values, leaving significant gaps for an AI agent to understand how to invoke it correctly.

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

Parameters3/5

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

The schema description coverage is 100%, with all parameters well-documented in the input schema (e.g., 'uri' overrides 'type' and 'id', 'type' has an enum). The description does not add any meaningful parameter details beyond what the schema provides, so it meets the baseline for high schema coverage without compensating further.

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

Purpose4/5

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

The description clearly states the verb ('Adds') and the resources ('track, album, artist or playlist') with the destination ('to the playback queue'), making the purpose specific and understandable. However, it does not explicitly distinguish this tool from sibling tools like 'playMusic' or 'getQueue', which could involve similar concepts but serve different functions.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives, such as 'playMusic' for immediate playback or 'getQueue' for viewing the queue. It lacks context about prerequisites (e.g., active playback) or exclusions, leaving usage unclear based solely on the description.

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/makesh-kumar/spotify-mcp-server'

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