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, };

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