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

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