Skip to main content
Glama

get_queue_length

Retrieve the current queue length of a specified Sonos device or the active device if none is provided. Use this tool to monitor and manage playback queues efficiently.

Instructions

Retrieve the queue length for a Sonos device.

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

Returns: int: The length of the queue.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo

Implementation Reference

  • The handler function for the 'get_queue_length' tool, decorated with @mcp.tool() which handles both implementation and registration in FastMCP. It fetches the Sonos device and returns its queue length using the helper function.
    @mcp.tool()
    def get_queue_length(name: Optional[str] = None) -> int:
        """Retrieve the queue length for a Sonos device.
        
        Args:
            name: The name of the device to retrieve the queue length from. If None, uses the current device.
            
        Returns:
            int: The length of the queue.
        """
        return fetch_queue_length(get_device(name))
  • Supporting helper utility that directly accesses the queue_size attribute from the Sonos SoCo object.
    def fetch_queue_length(sonos):
        """Return the queue length for a Sonos device.
        
        Args:
            sonos: The Sonos device to retrieve the queue length from.
            
        Returns:
            int: The length of the queue.
        """
        return sonos.queue_size
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool retrieves queue length but doesn't disclose behavioral aspects like whether this requires specific permissions, if it's a read-only operation (implied but not explicit), potential rate limits, error conditions, or how it handles invalid device names. The description is minimal beyond the basic function.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose in the first sentence. The Args and Returns sections are structured efficiently, though the formatting could be slightly more concise (e.g., integrating the parameter explanation into the main text). Overall, it avoids unnecessary verbosity.

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 no annotations, no output schema, and low schema coverage, the description is minimally adequate. It covers the purpose and parameter semantics but lacks behavioral context, usage guidelines, and details on return format beyond 'int'. For a simple read operation, this might suffice, but gaps remain in guiding the agent effectively.

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?

With 0% schema description coverage, the description compensates well by explaining the single parameter's semantics: 'name' is the device name, and if None, it uses the current device. This adds crucial meaning beyond the schema's basic type information, though it doesn't specify format constraints or examples.

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 length for a Sonos device'), distinguishing it from siblings like get_queue (which likely returns queue contents) or get_device_state (which returns broader state information). It precisely defines what the tool does without ambiguity.

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. With siblings like get_queue (which might return queue items) and get_device_state (which might include queue length among other metrics), there's no indication of when this specific queue-length retrieval is preferred over other tools that might provide similar or overlapping information.

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