Skip to main content
Glama

get_current_track

Retrieve details about the currently playing Spotify track, including title, artist, and album information.

Instructions

Get information about the currently playing track

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:149-152 (registration)
    Registration of the MCP tool 'get_current_track' using the @mcp.tool() decorator. This function serves as the tool handler, delegating to the SpotifyClient instance.
    @mcp.tool() async def get_current_track() -> str: """Get information about the currently playing track""" return await client.get_current_track()
  • main.py:149-152 (handler)
    The handler function for the 'get_current_track' tool, which calls the underlying SpotifyClient method.
    @mcp.tool() async def get_current_track() -> str: """Get information about the currently playing track""" return await client.get_current_track()
  • Core implementation in SpotifyClient class that fetches the current track using spotipy's current_user_playing_track() method.
    async def get_current_track(self) -> dict: """ Get detailed information about the currently playing track. Returns None if no track is currently playing. """ try: result = self.sp.current_user_playing_track() if not result: return "No track currently playing" return result except Exception as e: return f"Error getting current track: {str(e)}"

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/ashwanth1109/mcp-spotify'

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