Skip to main content
Glama
jamiew

Spotify MCP Server

remove_tracks_from_playlist

Delete specific songs from a Spotify playlist by providing playlist ID and track URIs to manage your music collection.

Instructions

Remove tracks from a playlist.

Args:
    playlist_id: Playlist ID
    track_uris: List of track URIs to remove

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlist_idYes
track_urisYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function implementing the 'remove_tracks_from_playlist' tool. Decorated with @mcp.tool() for FastMCP registration and @log_tool_execution for logging. Converts input track URIs, calls Spotify API to remove all occurrences of tracks from the playlist, returns success status, and handles Spotify exceptions.
    @mcp.tool()
    @log_tool_execution
    def remove_tracks_from_playlist(
        playlist_id: str, track_uris: list[str]
    ) -> dict[str, str]:
        """Remove tracks from a playlist.
    
        Args:
            playlist_id: Playlist ID
            track_uris: List of track URIs to remove
        """
        try:
            # Convert track IDs to URIs if needed
            uris = [
                uri if uri.startswith("spotify:track:") else f"spotify:track:{uri}"
                for uri in track_uris
            ]
    
            logger.info(f"🚮 Removing {len(uris)} tracks from playlist {playlist_id}")
            spotify_client.playlist_remove_all_occurrences_of_items(playlist_id, uris)
            return {
                "status": "success",
                "message": f"Removed {len(uris)} tracks from playlist",
            }
    
        except SpotifyException as e:
            raise convert_spotify_error(e) from e
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action is a removal (destructive operation) but doesn't mention permissions needed, whether changes are reversible, rate limits, or what happens if track_uris aren't in the playlist. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and well-structured: a clear purpose statement followed by a formatted parameter list. Every sentence earns its place with no wasted words, making it easy to scan and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations, 2 parameters, and an output schema exists, the description is minimally adequate. It covers the basic action and parameters but lacks behavioral context (permissions, reversibility) that would be important for safe usage. The output schema helps but doesn't fully compensate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description explicitly lists both parameters (playlist_id and track_uris) with brief explanations, adding meaningful context beyond the schema which has 0% description coverage. This compensates well for the schema gap, though it doesn't detail format constraints (e.g., URI structure).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Remove tracks from a playlist') with specific verb and resource, making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'modify_playlist_details' which might also handle track removal, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, limitations, or compare it to related tools like 'modify_playlist_details' or 'get_playlist_tracks' for context. Usage is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/jamiew/spotify-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server