add_to_playlist
Add tracks to an existing Spotify playlist. Automatically batches track URIs to comply with the Spotify API 100-track limit.
Instructions
Add one or more tracks to an existing Spotify playlist.
Handles batching automatically (Spotify API limit: 100 tracks per request).
Parameters
playlist_id : str Spotify playlist ID or full URI. track_uris : list[str] Spotify track URIs or bare track IDs.
Returns
dict
Keys: playlist_id (str), tracks_added (int).
Raises
ValueError
If track_uris is empty.
spotipy.SpotifyException
Propagated if the Spotify API returns a non-2xx response.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"playlist_id": "<playlist_id>",
"track_uris": "<track_uris>"
},
"name": "add_to_playlist"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| track_uris | Yes | ||
| playlist_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||