Skip to main content
Glama

get_queue

Retrieve a list of tracks in the playback queue for a specified Sonos device, providing detailed track information for media management and control.

Instructions

Retrieve the queue of tracks for a Sonos device.

Args: name: The name of the device to retrieve the queue from. If None, uses the current device.

Returns: List[Dict[str, Any]]: A list of dictionaries containing track information in the queue.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo

Implementation Reference

  • The main handler function for the 'get_queue' MCP tool, decorated with @mcp.tool(). It retrieves the queue from the Sonos device, marks the current track, and returns a list of track dictionaries with index, title, artist, album, and current flag.
    @mcp.tool()
    def get_queue(name: Optional[str] = None) -> List[Dict[str, Any]]:
        """Retrieve the queue of tracks for a Sonos device.
        
        Args:
            name: The name of the device to retrieve the queue from. If None, uses the current device.
            
        Returns:
            List[Dict[str, Any]]: A list of dictionaries containing track information in the queue.
        """
        sonos = get_device(name)
        tracks = sonos.get_queue()
        current = int(sonos.get_current_track_info()['playlist_position'])
        return [{
            "index": idx-1,
            "title": track.title,
            "artist": track.creator,
            "album": track.album,
            **({"current": True} if idx == current else {})
        } for idx, track in enumerate(tracks, 1)]
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the return format (list of dictionaries with track info) and the default behavior for the name parameter, but doesn't mention potential errors (e.g., invalid device name), permissions, rate limits, or whether this is a read-only operation. It adds some behavioral context but leaves gaps.

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 front-loaded with the core purpose, followed by structured Args and Returns sections. Every sentence earns its place: the first states what it does, the second explains the parameter, and the third defines the output. No wasted words, perfectly sized.

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

Completeness4/5

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

Given 1 parameter with 0% schema coverage and no output schema, the description does well by fully documenting the parameter and return format. However, as a tool with no annotations, it could better address behavioral aspects like error conditions or read-only nature. It's mostly complete but has minor gaps.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate. It fully explains the single parameter 'name': its purpose (device to retrieve queue from), data type (string or None), and default behavior (uses current device if None). This adds complete meaning beyond the bare schema.

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

Purpose5/5

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

The description clearly states the specific action ('Retrieve') and resource ('queue of tracks for a Sonos device'), distinguishing it from siblings like get_current_track_info (current track only) or get_queue_length (just count). It precisely defines what the tool does without being vague or tautological.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool (to get the queue list) and implies alternatives like get_current_track_info for single tracks, but doesn't explicitly state when NOT to use it or compare to all siblings like get_queue_length. This gives good guidance but lacks explicit exclusions.

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

Related 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/WinstonFassett/sonos-mcp-server'

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