Skip to main content
Glama
Cifero74

mcp-apple-music

add_tracks_to_playlist

Add songs from your library or Apple Music catalog to an existing playlist using track IDs and playlist ID.

Instructions

Add tracks to an existing playlist.

Args: playlist_id: The target playlist ID (starts with 'p.'). track_ids: List of track IDs to add. track_type: 'library-songs' for tracks from your library (default), 'songs' for catalog tracks found via search_catalog.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlist_idYes
track_idsYes
track_typeNolibrary-songs

Implementation Reference

  • The `add_tracks_to_playlist` function handles the request to add tracks to a specific Apple Music playlist by communicating with the client API.
    async def add_tracks_to_playlist(
        playlist_id: str,
        track_ids: list[str],
        track_type: str = "library-songs",
    ) -> str:
        """Add tracks to an existing playlist.
    
        Args:
            playlist_id: The target playlist ID (starts with 'p.').
            track_ids: List of track IDs to add.
            track_type: 'library-songs' for tracks from your library (default),
                        'songs' for catalog tracks found via search_catalog.
        """
        if not track_ids:
            return "❌ No track IDs provided."
    
        client = _get_client()
        body = {"data": [{"id": tid, "type": track_type} for tid in track_ids]}
        await client.post(f"/me/library/playlists/{playlist_id}/tracks", body)
    
        return (
            f"✅ Added {len(track_ids)} track(s) to playlist [{playlist_id}].\n"
            f"   Track IDs: {', '.join(track_ids)}"
        )

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