Skip to main content
Glama

get_device_state

Retrieve the current state of a Sonos device, including volume, playback status, and track details, by specifying the device name through the Sonos MCP Server.

Instructions

Retrieve the state information for a specific Sonos device.

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

Returns: Dict[str, Any]: A dictionary containing the device's name, volume, state, and current track information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo

Implementation Reference

  • The handler function for the 'get_device_state' tool. Decorated with @mcp.tool(), it retrieves and returns the state information (name, volume, playback state, and current track) for a specified or current Sonos device.
    @mcp.tool() def get_device_state(name: Optional[str] = None) -> Dict[str, Any]: """Retrieve the state information for a specific Sonos device. Args: name: The name of the device to retrieve state information for. If None, uses the current device. Returns: Dict[str, Any]: A dictionary containing the device's name, volume, state, and current track information. """ device = get_device(name) return { "name": device.player_name, "volume": device.volume, "state": device.get_current_transport_info()["current_transport_state"], "track": device.get_current_track_info() }

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