Skip to main content
Glama

get_liked_tracks

Retrieve your saved Spotify tracks to access your music library, create playlists, analyze preferences, or export favorites with timestamps and details.

Instructions

Access the user's personal collection of liked/saved tracks from their Spotify library.

🎯 USE CASES: β€’ Display user's favorite music collection in applications β€’ Create personalized playlists from liked songs β€’ Analyze personal music taste and preferences β€’ Build recommendation systems based on user favorites β€’ Export personal music library for backup or migration

πŸ“ WHAT IT RETURNS: β€’ Complete collection of user's liked/saved tracks β€’ Track information with save dates and timestamps β€’ Artist, album, and release information for each track β€’ Chronological order of when tracks were liked β€’ Total count of saved tracks in library

πŸ” EXAMPLES: β€’ "Show me my liked songs collection" β€’ "Get my 50 most recently liked tracks" β€’ "What songs have I saved to my library?" β€’ "Export my favorite tracks with save dates"

πŸ’– PERSONAL COLLECTION: β€’ Reflects user's musical taste and preferences β€’ Shows evolution of music taste over time β€’ Perfect for building "greatest hits" playlists β€’ Useful for music discovery based on preferences β€’ Great for sharing favorite music with friends

πŸ’‘ COLLECTION INSIGHTS: β€’ Track when musical tastes changed or evolved β€’ Identify patterns in saved music genres β€’ Use for personalized recommendation systems β€’ Perfect for "throwback" and nostalgia playlists β€’ Analyze your music journey over time

⚠️ REQUIREMENTS: β€’ Valid Spotify access token with user-library-read scope β€’ User must have saved tracks in their library

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
limitNo
offsetNo

Implementation Reference

  • The MCP tool handler function for 'get_liked_tracks' that extracts arguments and delegates to SpotifyService.getLikedTracks.
    handler: async (args: any, spotifyService: SpotifyService) => { const { token, limit = 20, offset = 0 } = args; return await spotifyService.getLikedTracks(token, limit, offset); },
  • Zod schema definition for input validation of the 'get_liked_tracks' tool parameters (token, limit, offset).
    schema: createSchema({ token: commonSchemas.token(), limit: commonSchemas.limit(1, 50, 20), offset: commonSchemas.offset(), }),
  • SpotifyService helper method that makes the API call to Spotify's /me/tracks endpoint to retrieve user's liked/saved tracks.
    async getLikedTracks( token: string, limit: number = 20, offset: number = 0 ): Promise<PagingObject<{ added_at: string; track: SpotifyTrack }>> { const params = { limit: Math.min(limit, 50), offset: offset, }; return await this.makeRequest< PagingObject<{ added_at: string; track: SpotifyTrack }> >("me/tracks", token, params); }
  • Registration of trackTools (including get_liked_tracks) into the allTools registry used by ToolRegistrar.
    ...trackTools,
  • Instantiation of ToolRegistrar which loads all tools including get_liked_tracks for MCP server.
    const toolRegistrar = new ToolRegistrar(spotifyService);

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