Skip to main content
Glama

get_playlist_tracks

Extract detailed track listings from Spotify playlists to analyze songs, create backups, or build music applications with complete metadata.

Instructions

Get the complete track listing from any playlist with detailed song information and metadata.

🎯 USE CASES: • Extract songs from playlists for custom music apps • Analyze musical patterns and genre distributions • Create backup copies or derivative playlists • Study playlist curation and track progression • Build recommendation systems based on playlist contents

📝 WHAT IT RETURNS: • Complete ordered track listing from the playlist • Song titles, artists, albums, and release dates • Track durations, popularity scores, and preview URLs • Added date and user who added each track • Explicit content flags and market availability

🔍 EXAMPLES: • "Get all tracks from my 'Road Trip' playlist" • "Show me songs in playlist ID: 1BxfuPKGuaTgP6aM0NMpti" • "List tracks from Spotify's RapCaviar playlist" • "Extract songs from this collaborative party playlist"

🎵 TRACK DETAILS: • Maintains original playlist order and context • Shows track addition history and contributors • Includes full metadata for each song • Perfect for playlist analysis and music research • Great for creating similar or inspired playlists

💡 ANALYSIS OPPORTUNITIES: • Genre distribution and musical diversity • Track popularity trends within playlists • Artist frequency and collaboration patterns • Temporal patterns in track additions

⚠️ REQUIREMENTS: • Valid Spotify access token • Playlist must be accessible to the user • Respect rate limits for large playlists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
playlistIdYesSpotify playlist ID or URI
limitNo

Implementation Reference

  • Core handler implementation in SpotifyService that fetches playlist tracks from the Spotify API using the /playlists/{playlistId}/tracks endpoint.
    async getPlaylistTracks(
      token: string,
      playlistId: string,
      limit: number = 50
    ): Promise<PagingObject<PlaylistTrack>> {
      const id = this.extractId(playlistId);
      const params = { limit: Math.min(limit, 50) };
      return await this.makeRequest<PagingObject<PlaylistTrack>>(
        `playlists/${id}/tracks`,
        token,
        params
      );
    }
  • MCP tool registration including title, description, input schema using Zod, and thin handler that delegates to SpotifyService.getPlaylistTracks.
      get_playlist_tracks: {
        title: "Get Playlist Tracks",
        description: `Get the complete track listing from any playlist with detailed song information and metadata.
    
    🎯 USE CASES:
    • Extract songs from playlists for custom music apps
    • Analyze musical patterns and genre distributions
    • Create backup copies or derivative playlists
    • Study playlist curation and track progression
    • Build recommendation systems based on playlist contents
    
    📝 WHAT IT RETURNS:
    • Complete ordered track listing from the playlist
    • Song titles, artists, albums, and release dates
    • Track durations, popularity scores, and preview URLs
    • Added date and user who added each track
    • Explicit content flags and market availability
    
    🔍 EXAMPLES:
    • "Get all tracks from my 'Road Trip' playlist"
    • "Show me songs in playlist ID: 1BxfuPKGuaTgP6aM0NMpti"
    • "List tracks from Spotify's RapCaviar playlist"
    • "Extract songs from this collaborative party playlist"
    
    🎵 TRACK DETAILS:
    • Maintains original playlist order and context
    • Shows track addition history and contributors
    • Includes full metadata for each song
    • Perfect for playlist analysis and music research
    • Great for creating similar or inspired playlists
    
    💡 ANALYSIS OPPORTUNITIES:
    • Genre distribution and musical diversity
    • Track popularity trends within playlists
    • Artist frequency and collaboration patterns
    • Temporal patterns in track additions
    
    ⚠️ REQUIREMENTS:
    • Valid Spotify access token
    • Playlist must be accessible to the user
    • Respect rate limits for large playlists`,
        schema: createSchema({
          token: commonSchemas.token(),
          playlistId: commonSchemas.spotifyId("playlist"),
          limit: commonSchemas.limit(1, 50, 50),
        }),
        handler: async (args: any, spotifyService: SpotifyService) => {
          const { token, playlistId, limit = 50 } = args;
          return await spotifyService.getPlaylistTracks(token, playlistId, limit);
        },
      },
  • Input schema definition for the get_playlist_tracks tool using createSchema with token, playlistId, and optional limit parameters.
    schema: createSchema({
      token: commonSchemas.token(),
      playlistId: commonSchemas.spotifyId("playlist"),
      limit: commonSchemas.limit(1, 50, 50),
    }),
  • Central registry where playlistTools (containing get_playlist_tracks) is spread into the allTools object used by the MCP server.
    export const allTools: ToolsRegistry = {
      ...albumTools,
    
      ...artistTools,
    
      ...trackTools,
    
      ...playlistTools,
    
      ...playbackTools,
    
      ...userTools,
    
      ...searchTools,
    };
Behavior4/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 effectively describes what the tool returns (detailed track information), maintains playlist order, and includes requirements like authentication tokens and rate limits. It doesn't explicitly state if it's read-only or has side effects, but 'Get' implies safe retrieval, and the requirements section covers practical constraints.

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

Conciseness3/5

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

The description is well-structured with sections like USE CASES and WHAT IT RETURNS, but it's overly verbose with redundant sections (e.g., TRACK DETAILS repeats return information). Some sentences, like 'Perfect for playlist analysis and music research,' add little new value. It could be more front-loaded and concise without losing clarity.

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

Completeness4/5

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

Given the complexity (3 parameters, no output schema, no annotations), the description is mostly complete. It covers purpose, usage, returns, examples, and requirements. However, it lacks explicit details on error handling or pagination for large playlists beyond a brief mention of rate limits, leaving some gaps in operational context.

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?

The schema description coverage is 67% (2 out of 3 parameters have descriptions). The description doesn't explicitly mention parameters, but the 'EXAMPLES' section illustrates usage with 'playlistId', and the 'REQUIREMENTS' section implies the need for a 'token'. It adds context for how parameters are used (e.g., playlist IDs or URIs) but doesn't detail the 'limit' parameter beyond what the schema provides.

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 tool's purpose with specific verb ('Get') and resource ('complete track listing from any playlist'), distinguishing it from siblings like 'get_playlist' (which likely returns playlist metadata) or 'get_liked_tracks' (which retrieves saved tracks). The opening sentence establishes a precise scope for what the tool does.

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

Usage Guidelines4/5

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

The 'USE CASES' section provides clear context for when to use this tool (e.g., extracting songs, analyzing patterns, creating backups). However, it doesn't explicitly mention when NOT to use it or name specific alternatives among sibling tools, such as 'get_playlist' for metadata-only retrieval or 'search_tracks' for broader searches.

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