search_and_add
Search for a track and add the top result to a Spotify playlist in one step.
Instructions
Search for a track and add the top result to a playlist in one step.
Parameters
query : str
Free-text search query (e.g. "Shape of You Ed Sheeran").
playlist_id : str
Spotify playlist ID or full URI to add the track to.
Returns
dict
Keys: track_name, artists, track_uri, playlist_id.
Raises
ValueError
If query is blank or the search returns no results.
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": {
"query": "<query>",
"playlist_id": "<playlist_id>"
},
"name": "search_and_add"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| playlist_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||