Skip to main content
Glama

add-tracks-to-playlist

Add multiple tracks to a Spotify playlist using their track IDs. Specify the playlist ID and track IDs to update your playlist directly through the MCP Claude Spotify integration.

Instructions

Add tracks to a playlist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlistIdYesSpotify ID of the playlist
trackIdsYesArray of Spotify track IDs to add

Implementation Reference

  • Handler function that validates input using AddTracksSchema, constructs track URIs, calls spotifyApiRequest to POST to /playlists/{playlistId}/tracks, and returns success message.
    if (name === "add-tracks-to-playlist") {
      const { playlistId, trackIds } = AddTracksSchema.parse(args);
      
      const uris = trackIds.map((id) => `spotify:track:${id}`);
      
      await spotifyApiRequest(
        `/playlists/${playlistId}/tracks`,
        "POST",
        {
          uris,
        }
      );
      
      return {
        content: [
          {
            type: "text",
            text: `Added ${trackIds.length} tracks to playlist with ID: ${playlistId}`,
          },
        ],
      };
    }
  • Zod validation schema for tool inputs: playlistId (string) and trackIds (array of strings).
    const AddTracksSchema = z.object({
      playlistId: z.string(),
      trackIds: z.array(z.string()),
    });
  • index.ts:751-771 (registration)
    Tool registration in ListTools handler, defining name, description, and input schema matching the Zod schema.
    {
      name: "add-tracks-to-playlist",
      description: "Add tracks to a playlist",
      inputSchema: {
        type: "object",
        properties: {
          playlistId: {
            type: "string",
            description: "Spotify ID of the playlist",
          },
          trackIds: {
            type: "array",
            items: {
              type: "string",
            },
            description: "Array of Spotify track IDs to add",
          },
        },
        required: ["playlistId", "trackIds"],
      },
    },
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 but only states the basic action. It doesn't mention whether this requires specific permissions (e.g., user authorization), rate limits, how duplicates are handled, or what happens on failure, which are critical for a mutation tool.

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 extremely concise with a single, direct sentence that front-loads the core action. There is no wasted language, making it efficient and easy to parse, though this brevity contributes to gaps in other dimensions.

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 tool's complexity as a mutation operation with no annotations or output schema, the description is insufficient. It lacks details on behavioral traits, error handling, return values, and integration with sibling tools, leaving significant gaps for effective agent 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?

The schema description coverage is 100%, with clear documentation for both parameters (playlistId and trackIds). The description adds no additional meaning beyond what the schema already provides, such as format examples or constraints, so it meets the baseline for adequate but unenhanced parameter information.

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 ('Add') and resource ('tracks to a playlist'), making the tool's function immediately understandable. However, it doesn't differentiate from potential sibling operations like 'create-playlist' or 'play-track', which would require more specificity for a perfect 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 'create-playlist' for new playlists or 'play-track' for immediate playback. It lacks context about prerequisites (e.g., needing an existing playlist) or exclusions, leaving usage unclear.

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

Related 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/imprvhub/mcp-claude-spotify'

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