Skip to main content
Glama

get_playlist_tracks

Extract detailed track listings from any Spotify playlist, including song titles, artists, albums, and metadata, for playlist analysis, backup, or custom music applications.

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
limitNo
playlistIdYesSpotify playlist ID or URI
tokenYesSpotify access token for authentication

Implementation Reference

  • The handler function for the get_playlist_tracks MCP tool that validates args and delegates to SpotifyService.getPlaylistTracks
    handler: async (args: any, spotifyService: SpotifyService) => { const { token, playlistId, limit = 50 } = args; return await spotifyService.getPlaylistTracks(token, playlistId, limit); },
  • Zod input schema for the tool defining parameters: token, playlistId, and optional limit
    schema: createSchema({ token: commonSchemas.token(), playlistId: commonSchemas.spotifyId("playlist"), limit: commonSchemas.limit(1, 50, 50), }),
  • SpotifyService method implementing the core logic to fetch playlist tracks via Spotify API
    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 ); }
  • Central tools registry where playlistTools (containing get_playlist_tracks) is registered by spreading into allTools, used by ToolRegistrar for MCP integration
    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