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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| description | No |
Implementation Reference
- src/tidal_mcp/server.py:557-591 (handler)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)}")
- src/tidal_mcp/models.py:131-137 (schema)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")
- src/tidal_mcp/server.py:557-591 (registration)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)}")