Skip to main content
Glama

save_playlist

Add user-created Spotify playlists to your library for offline access, follow collaborative playlists, and organize personal collections.

Instructions

Save a user-created playlist to your Spotify library (follow playlist).

🎯 USE CASES: β€’ Add user-created playlists to your library for offline access β€’ Follow collaborative playlists from friends β€’ Organize personal playlists into collections β€’ Follow community-created playlists

πŸ“ WHAT IT RETURNS: β€’ Confirmation of successful playlist save/follow β€’ Updated library status β€’ Playlist URL for easy sharing and access β€’ Error details for any failed saves

πŸ” EXAMPLES: β€’ "Save this collaborative playlist my friend created" β€’ "Follow this user-generated workout playlist" β€’ "Add this personal playlist to my library"

πŸ’‘ SAVE FEATURES: β€’ Works with user-created playlists β€’ Maintains playlist order and structure β€’ Perfect for following collaborative playlists β€’ Enables offline access to followed playlists

🚫 LIMITATIONS (as of November 27, 2024): β€’ Cannot save Spotify's official/editorial playlists β€’ Cannot follow algorithmic playlists (Discover Weekly, etc.) β€’ Only works with playlists created by users β€’ Spotify-owned playlists are restricted

πŸ”§ TROUBLESHOOTING: β€’ If you get 404 error: The playlist might be Spotify-owned β€’ Try with user-created playlists instead β€’ Check if playlist is public and accessible

⚠️ REQUIREMENTS: β€’ Valid Spotify access token with playlist-modify-public scope β€’ Playlist must be user-created (not Spotify-owned) β€’ Playlist must be public or accessible to your account

Input Schema

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

Implementation Reference

  • Handler function that executes the core logic of the 'save_playlist' MCP tool by extracting arguments and delegating to SpotifyService.savePlaylist.
    handler: async (args: any, spotifyService: SpotifyService) => { const { token, playlistId } = args; return await spotifyService.savePlaylist(token, playlistId); },
  • Zod-based input schema validation for the 'save_playlist' tool, requiring Spotify access token and playlist ID.
    schema: createSchema({ token: commonSchemas.token(), playlistId: commonSchemas.spotifyId("playlist"), }),
  • Supporting utility in SpotifyService that implements the playlist save operation via Spotify API call to follow the playlist.
    async savePlaylist(token: string, playlistId: string): Promise<void> { const id = this.extractId(playlistId); return await this.makeRequest<void>( `playlists/${id}/followers`, token, {}, "PUT" ); }
  • Registration of the playlistTools (containing 'save_playlist') into the central allTools registry used by ToolRegistrar for 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