Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication

Implementation Reference

  • Registration of the 'get_currently_playing' MCP tool, defining its title, description, input schema (token), and handler that delegates to SpotifyService.getCurrentPlayback
    get_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); }, },
  • 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); },
  • Input schema for the tool, requiring a Spotify access token.
    schema: createSchema({ token: commonSchemas.token(), }),
  • 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); }
  • 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"; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/latiftplgu/Spotify-OAuth-MCP-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server