Skip to main content
Glama
varunneal

Spotify MCP Server

by varunneal

SpotifyQueue

Manage your Spotify playback queue by adding tracks or viewing current queue items through the Spotify MCP Server.

Instructions

Manage the playback queue - get the queue or add tracks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform: 'add' or 'get'.
track_idNoTrack ID to add to queue (required for add action)

Implementation Reference

  • Handler for the SpotifyQueue tool within the main tool dispatcher (@server.call_tool()). Dispatches to spotify_client.add_to_queue() or get_queue() based on the 'action' parameter.
    case "Queue":
        logger.info(f"Queue operation with arguments: {arguments}")
        action = arguments.get("action")
    
        match action:
            case "add":
                track_id = arguments.get("track_id")
                if not track_id:
                    logger.error("track_id is required for add to queue.")
                    return [types.TextContent(
                        type="text",
                        text="track_id is required for add action"
                    )]
                spotify_client.add_to_queue(track_id)
                return [types.TextContent(
                    type="text",
                    text=f"Track added to queue."
                )]
    
            case "get":
                queue = spotify_client.get_queue()
                return [types.TextContent(
                    type="text",
                    text=json.dumps(queue, indent=2)
                )]
    
            case _:
                return [types.TextContent(
                    type="text",
                    text=f"Unknown queue action: {action}. Supported actions are: add, remove, and get."
                )]
  • Pydantic schema for the SpotifyQueue tool input, defining 'action' ('add' or 'get') and optional 'track_id'.
    class Queue(ToolModel):
        """Manage the playback queue - get the queue or add tracks."""
        action: str = Field(description="Action to perform: 'add' or 'get'.")
        track_id: Optional[str] = Field(default=None, description="Track ID to add to queue (required for add action)")
  • Registers the SpotifyQueue tool (as 'SpotifyQueue' via Queue.as_tool()) in the MCP server tool list.
    @server.list_tools()
    async def handle_list_tools() -> list[types.Tool]:
        """List available tools."""
        logger.info("Listing available tools")
        # await server.request_context.session.send_notification("are you recieving this notification?")
        tools = [
            Playback.as_tool(),
            Search.as_tool(),
            Queue.as_tool(),
            GetInfo.as_tool(),
            Playlist.as_tool(),
        ]
        logger.info(f"Available tools: {[tool.name for tool in tools]}")
        return tools
  • Core helper method: adds a track to the Spotify playback queue using spotipy.
    def add_to_queue(self, track_id: str, device=None):
        """
        Adds track to queue.
        - track_id: ID of track to play.
        """
        self.sp.add_to_queue(track_id, device.get('id') if device else None)
  • Core helper method: retrieves the current Spotify queue, parses tracks, and includes currently playing track.
    def get_queue(self, device=None):
        """Returns the current queue of tracks."""
        queue_info = self.sp.queue()
        queue_info['currently_playing'] = self.get_current_track()
    
        queue_info['queue'] = [utils.parse_track(track) for track in queue_info.pop('queue')]
    
        return queue_info
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the two actions but doesn't describe what 'get' returns (e.g., list of tracks, current position), what 'add' does (e.g., adds to end of queue, requires active playback), error conditions, or rate limits. This leaves significant gaps for a tool that modifies playback state.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (one sentence) and front-loaded with the core purpose. Every word earns its place with no redundant information, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool (with 'add' action) with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns for either action, what happens on errors, or prerequisites like needing active playback. For a tool that can modify state, this leaves too many unknowns.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters (action with two options, track_id as required for add). The description adds no additional parameter semantics beyond what's in the schema, maintaining the baseline score for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as managing the playback queue with two specific actions: getting the queue or adding tracks. It uses specific verbs ('get', 'add') and identifies the resource ('playback queue'), but doesn't explicitly differentiate from sibling tools like SpotifyPlayback which might handle other playback controls.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through the action parameter description ('add' or 'get'), suggesting when to use each mode. However, it doesn't provide explicit guidance on when to choose this tool over alternatives like SpotifyPlayback for queue management versus other playback functions, or when track_id is required versus optional.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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