Skip to main content
Glama
jamiew

Spotify MCP Server

add_to_queue

Add a Spotify track to your playback queue using its track ID. This tool lets you queue songs for continuous listening without interrupting current playback.

Instructions

Add a track to the playback queue.

Args:
    track_id: Spotify track ID to add to queue
Returns:
    Dict with status and message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
track_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'add_to_queue' MCP tool. Decorated with @mcp.tool() for automatic registration in FastMCP. Takes a track_id parameter, formats it as a Spotify URI, and calls the underlying spotipy client's add_to_queue method. Returns a success message or raises an error.
    @mcp.tool()
    @log_tool_execution
    def add_to_queue(track_id: str) -> dict[str, str]:
        """Add a track to the playback queue.
    
        Args:
            track_id: Spotify track ID to add to queue
        Returns:
            Dict with status and message
        """
        try:
            logger.info(f"🎵 Adding track {track_id} to queue")
            spotify_client.add_to_queue(f"spotify:track:{track_id}")
            return {"status": "success", "message": "Added track to queue"}
        except SpotifyException as e:
            raise convert_spotify_error(e) from e
  • The @mcp.tool() decorator registers the add_to_queue function as an MCP tool in the FastMCP server. The @log_tool_execution decorator adds logging.
    @mcp.tool()
  • Supporting method in the SpotifyClient wrapper class that wraps spotipy's add_to_queue. Although not directly called by the tool handler (which uses the raw spotipy client), it provides a similar interface for adding tracks to the queue.
    def add_to_queue(self, track_id: str, device: dict[str, Any] | None = None) -> 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 full burden for behavioral disclosure. It states the action ('Add a track') and mentions a return format ('Dict with status and message'), but lacks critical details: whether this requires specific permissions (e.g., premium account), if it affects current playback, rate limits, or error conditions. For a mutation tool with zero annotation coverage, this is insufficient.

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 efficiently structured with a clear purpose statement followed by parameter and return value sections. Every sentence adds value: the first explains the tool's function, the second defines the parameter, and the third describes the return format. No redundant or verbose language is present.

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

Completeness3/5

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

Given the tool's moderate complexity (single parameter mutation), no annotations, but an output schema exists, the description is minimally adequate. It covers the basic action and parameter, and the output schema will handle return values. However, it lacks important context like authentication requirements, side effects on playback, or error handling, leaving gaps for the agent.

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

Parameters4/5

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

The description explicitly documents the single parameter ('track_id: Spotify track ID to add to queue'), adding meaningful context beyond the schema's minimal title ('Track Id') and 0% coverage. This clarifies the parameter's purpose and format, though it doesn't specify where to obtain valid track IDs or provide examples.

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 verb ('Add') and resource ('track to the playback queue'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from similar sibling tools like 'add_tracks_to_playlist' or 'modify_playlist_details', which would require more specific language about queue vs playlist operations.

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 on when to use this tool versus alternatives like 'add_tracks_to_playlist' or 'modify_playlist_details'. There's no mention of prerequisites (e.g., needing active playback), appropriate contexts, or limitations. The agent must infer usage from the tool name alone.

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

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