get_user_playlists
Retrieve your personal TIDAL playlists to access and manage your music collections directly from the streaming service.
Instructions
Get list of user's own playlists from TIDAL.
Args: limit: Maximum playlists to return (default: 50)
Returns: List of user's playlists
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- src/tidal_mcp/server.py:472-506 (handler)The handler function implementing the get_user_playlists tool logic using tidalapi to fetch and format user's playlists.@mcp.tool() async def get_user_playlists(limit: int = 50) -> PlaylistList: """ Get list of user's own playlists from TIDAL. Args: limit: Maximum playlists to return (default: 50) Returns: List of user's playlists """ if not await ensure_authenticated(): raise ToolError("Not authenticated. Please run the 'login' tool first.") try: all_playlists = await anyio.to_thread.run_sync(session.user.playlists) limited_playlists = all_playlists[:limit] if limit else all_playlists playlists = [] for playlist in limited_playlists: playlists.append( Playlist( id=str(playlist.id), name=playlist.name, description=getattr(playlist, "description", "") or "", track_count=getattr(playlist, "num_tracks", 0), creator=None, # User's own playlists url=f"https://tidal.com/browse/playlist/{playlist.id}", ) ) return PlaylistList(status="success", count=len(playlists), playlists=playlists) except Exception as e: raise ToolError(f"Failed to get playlists: {str(e)}")
- src/tidal_mcp/models.py:89-96 (schema)Pydantic BaseModel defining the output schema (PlaylistList) returned by the tool.class PlaylistList(BaseModel): """List of playlists with metadata.""" status: str = Field(description="Operation status (success/error)") query: Optional[str] = Field(None, description="Search query used (for search results)") count: int = Field(description="Number of playlists returned") playlists: List[Playlist] = Field(description="List of playlist objects")
- src/tidal_mcp/models.py:47-56 (schema)Pydantic BaseModel defining the Playlist entity used within the tool's output schema.class Playlist(BaseModel): """Structured representation of a TIDAL playlist.""" id: str = Field(description="Unique playlist ID (UUID)") name: str = Field(description="Playlist name") description: str = Field(description="Playlist description") track_count: int = Field(description="Number of tracks in playlist") creator: Optional[str] = Field(None, description="Playlist creator name") url: str = Field(description="TIDAL web URL for the playlist")