Skip to main content
Glama

speaker_info

Retrieve detailed speaker information for a specified or active Sonos device using the MCP Server, enabling precise control and management of your audio setup.

Instructions

Retrieve speaker information for a Sonos device.

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

Returns: Dict[str, str]: A dictionary containing speaker information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo

Implementation Reference

  • The core handler function for the 'speaker_info' MCP tool, decorated with @mcp.tool() for registration. It uses the helper get_device to obtain the Sonos device and calls its get_speaker_info() method to return the speaker details as a dictionary.
    @mcp.tool()
    def speaker_info(name: Optional[str] = None) -> Dict[str, str]:
        """Retrieve speaker information for a Sonos device.
        
        Args:
            name: The name of the device to retrieve speaker information from. If None, uses the current device.
            
        Returns:
            Dict[str, str]: A dictionary containing speaker information.
        """
        return get_device(name).get_speaker_info()
  • Supporting helper function get_device that resolves the Sonos device by name (case-insensitive) or defaults to the first/current device, used by the speaker_info handler.
    def get_device(name: Optional[str] = None) -> soco.SoCo:
        """Retrieve a Sonos device by name or return the current device.
        
        Args:
            name: The name of the device to retrieve. If None, returns the current device.
            
        Returns:
            soco.SoCo: The Sonos device object.
            
        Raises:
            ValueError: If the specified device name is not found.
        """
        global device
        if not name and device:
            return device
        
        devices = get_devices()
        if not name:
            device = devices[list(devices.keys())[0]]
            return device
        
        if name in devices:
            device = devices[name]
            return device
        
        for key in devices:
            if key.lower() == name.lower():
                device = devices[key]
                return device
                
        raise ValueError(f"Device {name} not found")
  • server.py:264-264 (registration)
    The @mcp.tool() decorator registers the speaker_info function as an MCP tool.
    @mcp.tool()
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