get_currently_playing
Retrieve real-time information about the currently playing track in a Spotify session, including artist, album, playback progress, and device status.
Instructions
Get real-time information about what's currently playing in the user's Spotify session.
π― USE CASES: β’ Display "Now Playing" information in applications β’ Track listening history and habits in real-time β’ Create social media posts about current music β’ Build music discovery features based on current listening β’ Monitor playback state for automation and smart home integration
π WHAT IT RETURNS: β’ Currently playing track with artist and album information β’ Playback progress (current position vs. total duration) β’ Playback state (playing, paused, stopped) β’ Active device information and volume level β’ Shuffle and repeat mode settings β’ Track popularity and explicit content flags
π EXAMPLES: β’ "What song is currently playing?" β’ "Show me my current playback status" β’ "Get the current track and how much time is left" β’ "What device am I listening on right now?"
π‘ REAL-TIME FEATURES: β’ Updates instantly as tracks change β’ Shows exact playback position down to milliseconds β’ Indicates if user is actively listening or paused β’ Perfect for building live music widgets
β οΈ REQUIREMENTS: β’ Valid Spotify access token with user-read-playback-state scope β’ User must have an active Spotify session
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Spotify access token for authentication |
Implementation Reference
- src/mcp/tools/playback.ts:6-47 (registration)Registration of the 'get_currently_playing' MCP tool, defining its title, description, input schema (token), and handler that delegates to SpotifyService.getCurrentPlaybackget_currently_playing: { title: "Get Currently Playing Track", description: `Get real-time information about what's currently playing in the user's Spotify session. π― USE CASES: β’ Display "Now Playing" information in applications β’ Track listening history and habits in real-time β’ Create social media posts about current music β’ Build music discovery features based on current listening β’ Monitor playback state for automation and smart home integration π WHAT IT RETURNS: β’ Currently playing track with artist and album information β’ Playback progress (current position vs. total duration) β’ Playback state (playing, paused, stopped) β’ Active device information and volume level β’ Shuffle and repeat mode settings β’ Track popularity and explicit content flags π EXAMPLES: β’ "What song is currently playing?" β’ "Show me my current playback status" β’ "Get the current track and how much time is left" β’ "What device am I listening on right now?" π‘ REAL-TIME FEATURES: β’ Updates instantly as tracks change β’ Shows exact playback position down to milliseconds β’ Indicates if user is actively listening or paused β’ Perfect for building live music widgets β οΈ REQUIREMENTS: β’ Valid Spotify access token with user-read-playback-state scope β’ User must have an active Spotify session`, schema: createSchema({ token: commonSchemas.token(), }), handler: async (args: any, spotifyService: SpotifyService) => { const { token } = args; return await spotifyService.getCurrentPlayback(token); }, },
- src/mcp/tools/playback.ts:43-46 (handler)Handler function for the 'get_currently_playing' tool. Parses args for token and calls SpotifyService.getCurrentPlayback(token).handler: async (args: any, spotifyService: SpotifyService) => { const { token } = args; return await spotifyService.getCurrentPlayback(token); },
- src/mcp/tools/playback.ts:40-42 (schema)Input schema for the tool, requiring a Spotify access token.schema: createSchema({ token: commonSchemas.token(), }),
- src/spotify.ts:600-602 (helper)Core implementation in SpotifyService: makes authenticated GET request to Spotify API endpoint '/me/player' to fetch current playback state.async getCurrentPlayback(token: string): Promise<CurrentPlayback | null> { return await this.makeRequest<CurrentPlayback | null>("me/player", token); }
- src/spotify.ts:124-139 (schema)TypeScript interface defining the structure of the current playback response from Spotify API.export interface CurrentPlayback { device: SpotifyDevice; repeat_state: "off" | "track" | "context"; shuffle_state: boolean; context: { type: string; href: string; external_urls: { spotify: string }; uri: string; } | null; timestamp: number; progress_ms: number | null; is_playing: boolean; item: SpotifyTrack | null; currently_playing_type: "track" | "episode" | "ad" | "unknown"; }