playlist_trim
Trim a Spotify playlist to N items by keeping the first, last, or random tracks; overwrites the playlist, deletes excluded rows, and asks confirmation.
Instructions
Trim playlist to N items (keep first/last/random) by OVERWRITING the playlist: every row outside the kept set is DELETED, and the kept rows are re-written in the new order. An overwrite that deletes rows asks for confirmation first. Quota: 2 walks of the playlist items + 2 metadata GETs + PUT/POST.
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>",
"keep": "<keep>"
},
"name": "playlist_trim"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keep | Yes | How many items to keep | |
| dry_run | No | Preview only: validate inputs and describe exactly what would change without performing it | |
| keep_which | No | Which end of the playlist to keep items from. Default first | first |
| playlist_id | Yes | Playlist ID, spotify:playlist: URI, or URL |