Skip to main content
Glama

mode

Control or retrieve the play mode of a Sonos device, such as 'NORMAL', 'SHUFFLE_NOREPEAT', 'SHUFFLE', or 'REPEAT_ALL', by specifying the mode and device name.

Instructions

Get or set the play mode of a Sonos device.

Args: mode: The play mode to set (e.g., "NORMAL", "SHUFFLE_NOREPEAT", "SHUFFLE", "REPEAT_ALL"). If None, returns the current mode. name: The name of the device to set the mode for. If None, uses the current device.

Returns: str: The current play mode after the operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo
nameNo

Implementation Reference

  • The handler function for the 'mode' MCP tool, decorated with @mcp.tool() for registration. It gets or sets the play mode (NORMAL, SHUFFLE_NOREPEAT, SHUFFLE, REPEAT_ALL) on a Sonos device, using type hints and docstring for schema.
    @mcp.tool() def mode( mode: Optional[Literal["NORMAL", "SHUFFLE_NOREPEAT", "SHUFFLE", "REPEAT_ALL"]] = None, name: Optional[str] = None ) -> str: """Get or set the play mode of a Sonos device. Args: mode: The play mode to set (e.g., "NORMAL", "SHUFFLE_NOREPEAT", "SHUFFLE", "REPEAT_ALL"). If None, returns the current mode. name: The name of the device to set the mode for. If None, uses the current device. Returns: str: The current play mode after the operation. """ device = get_device(name) if mode: device.play_mode = mode return device.play_mode

Other Tools

Related Tools

  • @WinstonFassett/sonos-mcp-server
  • @WinstonFassett/sonos-mcp-server
  • @WinstonFassett/sonos-mcp-server
  • @WinstonFassett/sonos-mcp-server
  • @WinstonFassett/sonos-mcp-server
  • @WinstonFassett/sonos-mcp-server

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