Skip to main content
Glama
Cifero74

mcp-apple-music

get_recently_played

Retrieve recently played albums, playlists, and stations from Apple Music to review your listening history and rediscover content.

Instructions

Get your recently played albums, playlists, and stations.

Note: Apple Music API returns recently-played containers (albums, playlists, stations) rather than individual tracks.

Args: limit: Number of items to return, 1–50 (default 10).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • The implementation of the get_recently_played tool, which fetches recently played items from the Apple Music API using the authenticated client.
    async def get_recently_played(limit: int = 10) -> str:
        """Get your recently played albums, playlists, and stations.
    
        Note: Apple Music API returns recently-played containers (albums,
        playlists, stations) rather than individual tracks.
    
        Args:
            limit: Number of items to return, 1–50 (default 10).
        """
        client = _get_client()
        data = await client.get(
            "/me/recent/played",
            params={"limit": min(max(1, limit), 50)},
        )
        items = data.get("data", [])
    
        if not items:
            return "No recently played items found."
    
        lines = [f"🕐 Recently Played ({len(items)} items):\n"]
        for i, item in enumerate(items, 1):
            a = item.get("attributes", {})
            t = item.get("type", "")
            pid = item.get("id", "?")
            name = a.get("name", "?")
    
            if "album" in t:
                emoji = "💿"
                detail = f" — {a.get('artistName', '')}"
  • Registration of the get_recently_played function as an MCP tool using the @mcp.tool() decorator.
    @mcp.tool()

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/Cifero74/mcp-apple-music'

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