Skip to main content
Glama
keenanbb

TIDAL MCP Server

by keenanbb

add_tracks_to_playlist

Add multiple tracks to a TIDAL playlist using track IDs. Specify playlist ID and track IDs to update your music collection.

Instructions

Add tracks to an existing playlist.

Args: playlist_id: ID of the playlist track_ids: List of track IDs to add

Returns: Success status and number of tracks added

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlist_idYes
track_idsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusYesOperation status (success/error)
messageYesStatus message
playlist_idYesID of the playlist
playlist_urlYesTIDAL web URL for the playlist
tracks_addedYesNumber of tracks successfully added
playlist_nameYesName of the playlist

Implementation Reference

  • The core handler function for the 'add_tracks_to_playlist' tool. Decorated with @mcp.tool() for automatic registration in FastMCP. Implements authentication check, playlist fetching, track ID conversion, addition via tidalapi.Playlist.add(), and structured result return.
    @mcp.tool()
    async def add_tracks_to_playlist(playlist_id: str, track_ids: List[str]) -> AddTracksResult:
        """
        Add tracks to an existing playlist.
    
        Args:
            playlist_id: ID of the playlist
            track_ids: List of track IDs to add
    
        Returns:
            Success status and number of tracks added
        """
        if not await ensure_authenticated():
            raise ToolError("Not authenticated. Please run the 'login' tool first.")
    
        try:
            playlist = await anyio.to_thread.run_sync(session.playlist, playlist_id)
            if not playlist:
                raise ToolError(f"Playlist with ID '{playlist_id}' not found")
    
            track_ids_int = [int(tid) for tid in track_ids]
            await anyio.to_thread.run_sync(playlist.add, track_ids_int)
    
            return AddTracksResult(
                status="success",
                playlist_id=playlist_id,
                playlist_name=playlist.name,
                tracks_added=len(track_ids),
                playlist_url=f"https://tidal.com/browse/playlist/{playlist_id}",
                message=f"Added {len(track_ids)} tracks to playlist '{playlist.name}'",
            )
        except ValueError as e:
            raise ToolError(f"Invalid track ID format: {str(e)}")
        except ToolError:
            raise
        except Exception as e:
            raise ToolError(f"Failed to add tracks: {str(e)}")
  • Pydantic model defining the structured output schema for the add_tracks_to_playlist tool response, ensuring type-safe JSON serialization with descriptive fields.
    class AddTracksResult(BaseModel):
        """Result of adding tracks to a playlist."""
    
        status: str = Field(description="Operation status (success/error)")
        playlist_id: str = Field(description="ID of the playlist")
        playlist_name: str = Field(description="Name of the playlist")
        tracks_added: int = Field(description="Number of tracks successfully added")
        playlist_url: str = Field(description="TIDAL web URL for the playlist")
        message: str = Field(description="Status message")
Behavior2/5

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

No annotations are provided, so the description carries full burden. While it mentions the tool adds tracks and returns success status, it doesn't disclose important behavioral traits: whether this requires authentication, what happens with duplicate tracks, rate limits, error conditions, or whether the operation is idempotent. For a mutation tool with zero annotation coverage, this is insufficient.

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 efficiently structured with a clear purpose statement followed by organized sections for Args and Returns. Every sentence earns its place: the first sentence states the core purpose, and the subsequent sections provide necessary parameter and return value information without redundancy.

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

Completeness4/5

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

Given the tool has an output schema (which handles return values), 0% schema description coverage for parameters, and no annotations, the description does a reasonably complete job. It covers the purpose, parameters, and return concept. However, as a mutation tool without annotations, it should ideally mention authentication requirements or other behavioral constraints for full completeness.

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?

With 0% schema description coverage, the description compensates well by clearly explaining both parameters: 'playlist_id: ID of the playlist' and 'track_ids: List of track IDs to add'. This adds essential semantic meaning beyond the bare schema. The description doesn't specify format requirements (e.g., ID format, array size limits), but provides good basic parameter understanding.

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 ('Add tracks') and target resource ('to an existing playlist'), making the purpose immediately understandable. It distinguishes from sibling tools like 'create_playlist' (which creates new playlists) and 'remove_tracks_from_playlist' (which removes tracks). However, it doesn't explicitly mention what makes it different from 'update_playlist' or other playlist-related tools.

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

Usage Guidelines3/5

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

The description implies usage when you want to add tracks to an existing playlist, but provides no explicit guidance on when to use this vs. alternatives like 'update_playlist' or 'create_playlist'. It mentions 'existing playlist' which helps differentiate from creation, but doesn't address other sibling tools or potential constraints.

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/keenanbb/tidal-mcp'

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