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
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Spotify access token for authentication | |
| playlistId | Yes | Spotify playlist ID or URI | |
| limit | No |
Implementation Reference
- src/spotify.ts:512-524 (handler)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 ); }
- src/mcp/tools/playlists.ts:99-149 (registration)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); }, },
- src/mcp/tools/playlists.ts:140-144 (schema)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), }),
- src/mcp/tools/index.ts:22-36 (registration)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, };