Skip to main content
Glama
igorgarbuz

Spotify MCP Node Server

by igorgarbuz

addToQueue

Add tracks, albums, artists, or playlists to your Spotify playback queue using Spotify URIs or IDs. Specify a device to control where music is queued.

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

  • The async handler function that implements the logic for adding a Spotify item (track, album, artist, or playlist) to the playback queue. It constructs the URI if needed, validates inputs, calls the Spotify API via handleSpotifyRequest, and returns success or error messages.
    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 the addToQueue tool, defining optional parameters: uri, type, id, and deviceId with descriptions.
    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/write.ts:238-243 (registration)
    The addToQueue tool is registered by inclusion in the exported writeTools array.
    export const writeTools = [
      addToQueue,
      addTracksToPlaylist,
      createPlaylist,
      removeTracksFromPlaylist,
    ];
  • src/index.ts:12-14 (registration)
    All tools from writeTools (including addToQueue) are registered on the MCP server using server.tool() in a loop.
    [...playTools, ...readTools, ...writeTools].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?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the action ('adds') but fails to describe critical behaviors such as whether this requires authentication, how it handles errors (e.g., if no device is active), or if it affects current playback. This leaves significant gaps in understanding the tool's operational context.

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 directly states the tool's function without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly.

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 playback-related tool with no annotations and no output schema, the description is insufficient. It lacks details on authentication requirements, error handling, interaction with other playback tools, and expected outcomes, leaving the agent with incomplete context for reliable use.

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?

Schema description coverage is 100%, so the input schema fully documents all parameters. The description adds no additional semantic information beyond implying that 'uri', 'type', and 'id' are used to specify the item, and 'deviceId' targets a device. This meets the baseline for high schema coverage without extra value.

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 resource ('track, album, artist or playlist') with the destination ('to the playback queue'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'playMusic' or 'playbackAction', which might have overlapping functionality, so it doesn't reach the highest score.

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 like 'playMusic' or 'playbackAction', nor does it mention prerequisites such as needing an active playback session. It simply states what the tool does without context, leaving the agent to infer usage scenarios.

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

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