create_playlist
Create a new playlist in your Apple Music library by specifying a name and optional description to organize your music collection.
Instructions
Create a new playlist in your Apple Music library.
Args: name: Name for the new playlist. description: Optional short description.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| description | No |
Implementation Reference
- src/mcp_apple_music/server.py:354-375 (handler)The create_playlist tool implementation that interacts with the Apple Music API to create a new playlist.
@mcp.tool() async def create_playlist(name: str, description: str = "") -> str: """Create a new playlist in your Apple Music library. Args: name: Name for the new playlist. description: Optional short description. """ client = _get_client() body: dict = {"attributes": {"name": name}} if description: body["attributes"]["description"] = description data = await client.post("/me/library/playlists", body) if data.get("data"): pl = data["data"][0] pl_id = pl.get("id", "?") pl_name = pl.get("attributes", {}).get("name", name) return f"✅ Playlist created!\nName: {pl_name}\nID: {pl_id}" return f"✅ Playlist '{name}' created successfully."