Skip to main content
Glama

volume

Adjust or retrieve the volume level (0-99) of a specified Sonos device using the Sonos MCP Server. Leave volume unset to check current level or specify a value to set it.

Instructions

Get or set the volume of a Sonos device.

Args: volume: The volume level to set (0-99). If None, returns current volume. name: The name of the device to control. If None, uses the current device.

Returns: int: The current volume level after the operation.

Raises: ValueError: If volume is not between 0 and 99. ValueError: If the specified device is not found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo
volumeNo

Implementation Reference

  • The handler function decorated with @mcp.tool(), implementing the logic to get or set the volume of a Sonos device. It uses get_device to select the device and validates the volume input.
    @mcp.tool()
    def volume(volume: Optional[int] = None, name: Optional[str] = None) -> int:
        """Get or set the volume of a Sonos device.
        
        Args:
            volume: The volume level to set (0-99). If None, returns current volume.
            name: The name of the device to control. If None, uses the current device.
            
        Returns:
            int: The current volume level after the operation.
            
        Raises:
            ValueError: If volume is not between 0 and 99.
            ValueError: If the specified device is not found.
        """
        device = get_device(name)
        if volume is not None:
            if not 0 <= volume <= 99:
                raise ValueError("Volume must be between 0 and 99")
            device.volume = volume
        return device.volume
  • server.py:295-295 (registration)
    The @mcp.tool() decorator registers the volume function as an MCP tool.
    @mcp.tool()
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: the dual get/set functionality, volume range constraints (0-99), default device behavior, return value format, and error conditions. It doesn't mention rate limits, authentication needs, or side effects, but covers the essential operational behavior.

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 perfectly structured and concise: a clear purpose statement followed by well-organized Args, Returns, and Raises sections. Every sentence adds value, with no redundancy or wasted words. The information is front-loaded with the core functionality stated first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 2-parameter tool with no annotations and no output schema, the description provides complete context: clear purpose, parameter semantics with defaults and constraints, return value specification, and error conditions. It addresses all necessary aspects for proper tool invocation without relying on structured fields.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by explaining both parameters in detail: 'volume' specifies the level to set (0-99) or returns current if None; 'name' specifies device to control or uses current if None. It adds crucial meaning beyond the bare schema, including default behaviors and constraints.

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 dual functionality: 'Get or set the volume of a Sonos device.' It specifies the exact action (get/set), resource (Sonos device volume), and distinguishes it from siblings like play/pause/stop which control playback, or get_device_state which provides broader device information.

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 provides clear context for when to use this tool: to get or set volume on Sonos devices. It distinguishes from siblings by focusing specifically on volume control rather than playback control or device state queries. However, it doesn't explicitly state when NOT to use it or mention specific alternatives for volume-related queries.

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