Skip to main content
Glama

remove_tracks

Remove unwanted or outdated tracks from your Spotify library to maintain a curated and relevant music collection. This tool helps clean up your library by removing tracks that no longer align with your current preferences, ensuring a more organized and personalized listening experience.

Instructions

Remove tracks from the user's personal library to maintain a curated collection of current favorites.

🎯 USE CASES: • Clean up library by removing tracks you no longer enjoy • Maintain relevance in your personal music collection • Remove accidental saves and unwanted additions • Update library to reflect changing musical tastes • Organize library by removing outdated preferences

📝 WHAT IT RETURNS: • Confirmation of successful track removals • Updated library count after removals • List of successfully removed tracks • Error details for tracks that couldn't be removed • Final library state after cleanup operation

🔍 EXAMPLES: • "Remove 'Old Song' from my liked tracks" • "Unlike these 3 tracks I no longer enjoy" • "Remove track IDs: 1BxfuPKGuaTgP6aM0NMpti, 4LRPiXqCikLlN15c3yImP7" • "Clean up my library by removing outdated music"

🧹 LIBRARY MAINTENANCE: • Keeps collection current and relevant • Reflects evolving musical tastes • Maintains quality over quantity approach • Perfect for regular library cleanup sessions • Essential for curated collection management

💡 CURATION TIPS: • Regular cleanup keeps library fresh • Remove tracks that no longer resonate • Consider seasonal relevance for cleanup timing • Use bulk removals for major library overhauls • Keep library aligned with current preferences

⚠️ REQUIREMENTS: • Valid Spotify access token with user-library-modify scope • Track IDs must match exactly for successful removal • Maximum 50 tracks can be removed per request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
trackIdsYesArray of Spotify track IDs to remove

Implementation Reference

  • MCP tool handler function for 'remove_tracks' that delegates to SpotifyService.removeTracks after extracting arguments.
    handler: async (args: any, spotifyService: SpotifyService) => { const { token, trackIds } = args; return await spotifyService.removeTracks(token, trackIds); }, },
  • Zod-based input schema for the remove_tracks tool, defining token and trackIds parameters.
    schema: createSchema({ token: commonSchemas.token(), trackIds: z .array(z.string()) .describe("Array of Spotify track IDs to remove"), }),
  • SpotifyService helper method that performs the actual API call to remove tracks from user's library via DELETE /me/tracks.
    async removeTracks( token: string, trackIds: string | string[] ): Promise<void> { const ids = Array.isArray(trackIds) ? trackIds.map((id) => this.extractId(id)) : [this.extractId(trackIds)]; const params = { ids: ids.join(",") }; return await this.makeRequest<void>("me/tracks", token, params, "DELETE"); }
  • Registration of trackTools (including remove_tracks) into the central allTools registry used by ToolRegistrar for MCP integration.
    export const allTools: ToolsRegistry = { ...albumTools, ...artistTools, ...trackTools, ...playlistTools, ...playbackTools, ...userTools, ...searchTools, };
  • MCP server request handler for calling tools dynamically using ToolRegistrar.createToolHandler, which wraps individual tool handlers including remove_tracks.
    server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const toolHandler = toolRegistrar.createToolHandler(name); const result = await toolHandler(args || {}); return { content: [ { type: "text", text: typeof result === "string" ? result : JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error executing tool '${name}': ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } });

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