get_library_artists
Retrieve a list of artists from your Apple Music library with pagination controls to manage large collections.
Instructions
List artists in your Apple Music library.
Args: limit: Number of artists 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:263-284 (handler)The implementation of the get_library_artists tool handler, which fetches artists from the Apple Music library using the client and formats the response.
@mcp.tool() async def get_library_artists(limit: int = 25, offset: int = 0) -> str: """List artists in your Apple Music library. Args: limit: Number of artists to return, 1–100 (default 25). offset: Pagination offset (default 0). """ client = _get_client() data = await client.get( "/me/library/artists", params={"limit": min(max(1, limit), 100), "offset": max(0, offset)}, ) artists = data.get("data", []) if not artists: return "No artists found in your library." lines = ["👤 Library Artists:\n"] for i, a in enumerate(artists, offset + 1): lines.append(_fmt_artist(a, i)) return "\n".join(lines)