Skip to main content
Glama
keenanbass1

TIDAL MCP Server

by keenanbass1

create_playlist

Create a new playlist in your TIDAL account by specifying a name and optional description. This tool helps organize your music collection with custom playlists.

Instructions

Create a new playlist in user's TIDAL account.

Args: name: Name for the playlist description: Optional description

Returns: Created playlist details including ID and URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
descriptionNo

Implementation Reference

  • The @mcp.tool()-decorated handler function that implements the create_playlist tool logic, authenticates the session, calls the underlying tidalapi session.user.create_playlist, constructs a Playlist object, and returns a CreatePlaylistResult.
    @mcp.tool()
    async def create_playlist(name: str, description: str = "") -> CreatePlaylistResult:
        """
        Create a new playlist in user's TIDAL account.
    
        Args:
            name: Name for the playlist
            description: Optional description
    
        Returns:
            Created playlist details including ID and URL
        """
        if not await ensure_authenticated():
            raise ToolError("Not authenticated. Please run the 'login' tool first.")
    
        try:
            playlist = await anyio.to_thread.run_sync(
                session.user.create_playlist, name, description
            )
    
            return CreatePlaylistResult(
                status="success",
                playlist=Playlist(
                    id=str(playlist.id),
                    name=playlist.name,
                    description=playlist.description or "",
                    track_count=0,
                    creator=None,
                    url=f"https://tidal.com/browse/playlist/{playlist.id}",
                ),
                message=f"Created playlist '{name}'",
            )
        except Exception as e:
            raise ToolError(f"Failed to create playlist: {str(e)}")
  • Pydantic BaseModel defining the return schema for the create_playlist tool, including status, playlist details, and message.
    class CreatePlaylistResult(BaseModel):
        """Result of creating a new playlist."""
    
        status: str = Field(description="Operation status (success/error)")
        playlist: Optional[Playlist] = Field(None, description="Created playlist details")
        message: str = Field(description="Status message")
  • The @mcp.tool() decorator registers this function as an MCP tool named 'create_playlist'.
    @mcp.tool()
    async def create_playlist(name: str, description: str = "") -> CreatePlaylistResult:
        """
        Create a new playlist in user's TIDAL account.
    
        Args:
            name: Name for the playlist
            description: Optional description
    
        Returns:
            Created playlist details including ID and URL
        """
        if not await ensure_authenticated():
            raise ToolError("Not authenticated. Please run the 'login' tool first.")
    
        try:
            playlist = await anyio.to_thread.run_sync(
                session.user.create_playlist, name, description
            )
    
            return CreatePlaylistResult(
                status="success",
                playlist=Playlist(
                    id=str(playlist.id),
                    name=playlist.name,
                    description=playlist.description or "",
                    track_count=0,
                    creator=None,
                    url=f"https://tidal.com/browse/playlist/{playlist.id}",
                ),
                message=f"Created playlist '{name}'",
            )
        except Exception as e:
            raise ToolError(f"Failed to create playlist: {str(e)}")

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

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