Skip to main content
Glama
boristopalov

Spotify MCP Server

by boristopalov

SpotifyQueue

Control your Spotify playback queue by adding tracks or viewing upcoming songs 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

  • Main execution handler for the SpotifyQueue tool within the @server.call_tool() function. Dispatches based on 'action' to either add a track to the queue or retrieve the current queue using the spotify_client.
    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 successfully."
                )]
    
            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 definition for SpotifyQueue tool inputs, used to generate the tool schema via ToolModel.as_tool().
    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)")
  • Registration of the SpotifyQueue tool (as Queue.as_tool()) in the @server.list_tools() handler.
    tools = [
        Playback.as_tool(),
        Search.as_tool(),
        Queue.as_tool(),
        GetInfo.as_tool(),
    ]
  • SpotifyClient helper method called by SpotifyQueue 'get' action to fetch and parse the current playback queue.
    def get_queue(self, device=None):
        """Returns the current queue of tracks."""
        queue_info = self.sp.queue()
        self.logger.info(f"currently playing keys {queue_info['currently_playing'].keys()}")
    
        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
  • SpotifyClient helper method called by SpotifyQueue 'add' action to add a track to the playback queue.
    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)
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. While it mentions two actions (get and add), it doesn't describe what 'get' returns (queue structure, track information), what happens when adding duplicates, whether there are queue size limits, authentication requirements, or rate limits. For a tool that modifies playback state, this is insufficient behavioral context.

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 - a single sentence with two clear clauses separated by a dash. Every word earns its place, and the information is front-loaded with the core functionality. There's zero waste or redundancy in the phrasing.

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 that this is a playback queue management tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'get' returns (queue structure), what format track_id should be in, whether there are constraints on queue operations, or how this integrates with the broader Spotify playback system. For a tool that both reads and modifies state, more context is needed.

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?

The description mentions 'get the queue or add tracks' which aligns with the 'action' parameter having 'add' or 'get' values, and implies 'track_id' is needed for 'add'. However, with 100% schema description coverage where both parameters are well-documented in the schema, the description adds minimal value beyond what's already in the structured data. The baseline of 3 is appropriate when the schema does the heavy lifting.

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 (get or add tracks), which is a specific verb+resource combination. However, it doesn't distinguish this tool from its siblings (SpotifyGetInfo, SpotifyPlayback, SpotifySearch) - all of which could potentially interact with queue functionality in some way.

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

Usage Guidelines2/5

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

The description provides no guidance about when to use this tool versus alternatives. There's no mention of when to choose 'get' versus 'add' actions, nor how this tool relates to the sibling tools (SpotifyPlayback in particular might have overlapping functionality). The description simply states what the tool does without providing usage context.

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

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