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()
        }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool retrieves state information (implying read-only behavior) and details the return format, but does not mention potential errors, rate limits, authentication needs, or side effects. It adds some behavioral context but is incomplete for a tool with zero annotation coverage.

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

Conciseness5/5

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

The description is front-loaded with the core purpose, followed by structured 'Args' and 'Returns' sections. Every sentence adds value without redundancy, making it efficient and well-organized for quick understanding.

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 provides adequate basics (purpose, parameter semantics, return format) but lacks details on error handling, performance, or integration with sibling tools. It is minimally viable but has clear gaps in contextual richness.

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?

The schema description coverage is 0%, so the description must compensate. It explains the 'name' parameter's purpose, default behavior ('If None, uses the current device'), and effect, adding meaningful semantics beyond the bare schema. However, it does not specify format constraints or examples for the 'name' value.

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'), resource ('state information'), and target ('specific Sonos device'). It distinguishes from siblings like 'get_all_device_states' (which retrieves all devices) and 'speaker_info' (which likely provides different metadata).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'for a specific Sonos device' and noting the default behavior when 'name' is None, but it does not explicitly state when to use this tool versus alternatives like 'get_all_device_states' or 'now_playing'. The guidance is clear but lacks explicit sibling differentiation.

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