Skip to main content
Glama

get_playback_state

Retrieve current playback details from Spotify, including track information and player status.

Instructions

Get current playback information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:66-69 (handler)
    The MCP tool handler function for 'get_playback_state', decorated with @mcp.tool() for registration and execution. It delegates to SpotifyClient.get_current_playback().
    @mcp.tool()
    async def get_playback_state() -> str:
        """Get current playback information"""
        return await client.get_current_playback()
  • Supporting method in SpotifyClient class that implements the core logic by calling spotipy's current_playback() to retrieve the playback state.
    async def get_current_playback(self) -> str:
        """
        Get information about current playback state.
        """
        try:
            playback = self.sp.current_playback()
            if not playback:
                return "No active playback session."
            return playback
        except Exception as e:
            return f"Error getting playback state: {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