Spotify Player Control
Control Spotify playback, search music, and manage playlists.
Available Tools
- web_fetch: Access Spotify Web API
- bash: Use spotify-cli if installed
Spotify Web API
Base URL: https://api.spotify.com/v1/
Authentication
Get access token:
POST https://accounts.spotify.com/api/token
Headers:
Authorization: Basic {base64(client_id:client_secret)}
Body: grant_type=client_credentials
Common Endpoints
Get Currently Playing
GET https://api.spotify.com/v1/me/player/currently-playing
Headers:
Authorization: Bearer {access_token}
Search
GET https://api.spotify.com/v1/search?q={query}&type=track,artist,album
Play Track
PUT https://api.spotify.com/v1/me/player/play
Body: {"uris": ["spotify:track:{track_id}"]}
Pause
PUT https://api.spotify.com/v1/me/player/pause
Next/Previous
POST https://api.spotify.com/v1/me/player/next
POST https://api.spotify.com/v1/me/player/previous
Usage Examples
User: "Play Shape of You by Ed Sheeran"
- Search for track using /v1/search
- Get track URI
- Play using /v1/me/player/play
User: "What's currently playing?"
- Fetch from /v1/me/player/currently-playing
- Parse track info
- Present artist, track, album
User: "Pause Spotify"
- Call /v1/me/player/pause
Environment Setup
export SPOTIFY_CLIENT_ID="your_client_id"
export SPOTIFY_CLIENT_SECRET="your_client_secret"
Get credentials from: https://developer.spotify.com/dashboard
Scopes Required
For user playback control:
user-read-playback-stateuser-modify-playback-stateuser-read-currently-playing