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
| Name | Required | Description | Default |
|---|---|---|---|
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()
- spotify.py:256-267 (helper)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)}"