get_library_albums
Retrieve albums from your Apple Music library with pagination controls to manage large collections efficiently.
Instructions
List albums saved in your Apple Music library.
Args: limit: Number of albums to return, 1–100 (default 25). offset: Pagination offset (default 0).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No |
Implementation Reference
- src/mcp_apple_music/server.py:233-255 (handler)The 'get_library_albums' handler function which fetches and formats library albums from Apple Music.
@mcp.tool() async def get_library_albums(limit: int = 25, offset: int = 0) -> str: """List albums saved in your Apple Music library. Args: limit: Number of albums to return, 1–100 (default 25). offset: Pagination offset (default 0). """ client = _get_client() data = await client.get( "/me/library/albums", params={"limit": min(max(1, limit), 100), "offset": max(0, offset)}, ) albums = data.get("data", []) total = data.get("meta", {}).get("total", "?") if not albums: return "No albums found in your library." lines = [f"💿 Library Albums — showing {offset + 1}–{offset + len(albums)} of {total}:\n"] for i, a in enumerate(albums, offset + 1): lines.append(_fmt_album(a, i)) return "\n".join(lines)