Skip to main content
Glama

remove_from_playlist

Eliminate unwanted tracks from your Spotify playlists to maintain quality and relevance. Remove single or multiple songs, fix duplicates, update seasonal lists, and collaborate on shared playlists efficiently.

Instructions

Remove unwanted tracks from any playlist that the user owns or can modify.

🎯 USE CASES: • Clean up playlists by removing outdated or unwanted songs • Maintain playlist quality by pruning poor matches • Remove duplicates and fix playlist organization • Update seasonal playlists by removing irrelevant tracks • Collaborate on playlist refinement with shared editing

📝 WHAT IT RETURNS: • Confirmation of successful track removals • Updated playlist length and duration • New snapshot ID reflecting the changes • List of successfully removed tracks • Error details for tracks that couldn't be removed

🔍 EXAMPLES: • "Remove 'Yesterday' from my Modern Hits playlist" • "Delete these 3 songs from my party playlist" • "Remove track spotify:track:4uLU6hMCjMI75M1A2tKUQC from favorites" • "Clean up duplicate songs from my road trip playlist"

🧹 CLEANING FEATURES: • Remove single tracks or multiple tracks at once • Maintains playlist integrity after removals • Preserves order of remaining tracks • Perfect for playlist maintenance and curation • Supports bulk removals for efficiency

💡 MAINTENANCE TIPS: • Regular cleanup keeps playlists relevant • Remove songs that no longer fit the theme • Check for duplicates and outdated content • Consider seasonal relevance for themed playlists • Use bulk removals for major playlist overhauls

⚠️ REQUIREMENTS: • Valid Spotify access token with playlist-modify scopes • User must own playlist or have collaborative access • Track URIs must match exactly for successful removal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlistIdYesSpotify playlist ID or URI
tokenYesSpotify access token for authentication
trackUrisYesArray of Spotify track URIs

Implementation Reference

  • Registers the 'remove_from_playlist' MCP tool including title, description, input schema, and handler function that delegates to SpotifyService.
    remove_from_playlist: { title: "Remove Tracks from Playlist", description: `Remove unwanted tracks from any playlist that the user owns or can modify. 🎯 USE CASES: • Clean up playlists by removing outdated or unwanted songs • Maintain playlist quality by pruning poor matches • Remove duplicates and fix playlist organization • Update seasonal playlists by removing irrelevant tracks • Collaborate on playlist refinement with shared editing 📝 WHAT IT RETURNS: • Confirmation of successful track removals • Updated playlist length and duration • New snapshot ID reflecting the changes • List of successfully removed tracks • Error details for tracks that couldn't be removed 🔍 EXAMPLES: • "Remove 'Yesterday' from my Modern Hits playlist" • "Delete these 3 songs from my party playlist" • "Remove track spotify:track:4uLU6hMCjMI75M1A2tKUQC from favorites" • "Clean up duplicate songs from my road trip playlist" 🧹 CLEANING FEATURES: • Remove single tracks or multiple tracks at once • Maintains playlist integrity after removals • Preserves order of remaining tracks • Perfect for playlist maintenance and curation • Supports bulk removals for efficiency 💡 MAINTENANCE TIPS: • Regular cleanup keeps playlists relevant • Remove songs that no longer fit the theme • Check for duplicates and outdated content • Consider seasonal relevance for themed playlists • Use bulk removals for major playlist overhauls ⚠️ REQUIREMENTS: • Valid Spotify access token with playlist-modify scopes • User must own playlist or have collaborative access • Track URIs must match exactly for successful removal`, schema: createSchema({ token: commonSchemas.token(), playlistId: commonSchemas.spotifyId("playlist"), trackUris: commonSchemas.trackUris(), }), handler: async (args: any, spotifyService: SpotifyService) => { const { token, playlistId, trackUris } = args; return await spotifyService.removeTracksFromPlaylist( token, playlistId, trackUris ); }, },
  • Tool handler function: destructures input args and calls SpotifyService.removeTracksFromPlaylist to execute the removal.
    handler: async (args: any, spotifyService: SpotifyService) => { const { token, playlistId, trackUris } = args; return await spotifyService.removeTracksFromPlaylist( token, playlistId, trackUris ); },
  • Input schema definition using createSchema with token, playlistId (Spotify playlist ID), and trackUris (array of track URIs).
    schema: createSchema({ token: commonSchemas.token(), playlistId: commonSchemas.spotifyId("playlist"), trackUris: commonSchemas.trackUris(), }),
  • Core implementation in SpotifyService: extracts playlist ID, formats tracks data as array of {uri}, sends DELETE request to Spotify API /playlists/{id}/tracks.
    async removeTracksFromPlaylist( token: string, playlistId: string, trackUris: string | string[] ): Promise<{ snapshot_id: string }> { const id = this.extractId(playlistId); const data = { tracks: (Array.isArray(trackUris) ? trackUris : [trackUris]).map( (uri) => ({ uri }) ), }; return await this.makeRequest<{ snapshot_id: string }>( `playlists/${id}/tracks`, token, {}, "DELETE", data ); }

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