Skip to main content
Glama

stop

Halt playback on a specified Sonos device or the currently active one. Returns the updated device state, including volume, playback status, and track information.

Instructions

Stop playback on a Sonos device.

Args: name: The name of the device to stop. If None, uses the current device.

Returns: Dict[str, Any]: The device's state after stopping, including name, volume, state, and track info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo

Implementation Reference

  • The handler function for the MCP 'stop' tool. It retrieves the specified Sonos device, calls device.stop() to halt playback, and returns the updated device state via get_info_from.
    @mcp.tool()
    def stop(name: Optional[str] = None) -> Dict[str, Any]:
        """Stop playback on a Sonos device.
        
        Args:
            name: The name of the device to stop. If None, uses the current device.
            
        Returns:
            Dict[str, Any]: The device's state after stopping, including name, volume, state, and track info.
        """
        device = get_device(name)
        device.stop()
        return get_info_from(device)
  • server.py:157-157 (registration)
    The @mcp.tool() decorator registers the 'stop' function as an MCP tool.
    @mcp.tool()
  • Helper function get_info_from used by the stop tool to return the device state after stopping.
    def get_info_from(device: soco.SoCo) -> Dict[str, Any]:
        """Retrieve detailed information from a Sonos device.
        
        Args:
            device: The Sonos device to retrieve information from.
            
        Returns:
            Dict[str, Any]: A dictionary containing the device's name, volume, state, and current track information.
        """
        track_info = device.get_current_track_info()
        return {
            "name": device.player_name,
            "volume": device.volume,
            "state": device.get_current_transport_info()["current_transport_state"],
            "track": {
                "title": track_info.get("title"),
                "artist": track_info.get("artist"),
                "album": track_info.get("album"),
                "position": track_info.get("position"),
                "duration": track_info.get("duration"),
                "playlist_position": track_info.get("playlist_position"),
                "album_art": track_info.get("album_art")
            }
        }
  • Helper function get_device used by the stop tool to select the target Sonos device.
    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")
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool stops playback and returns the device's state, but doesn't mention behavioral aspects like whether it requires specific permissions, if it's idempotent, or potential side effects. It adds some context but lacks rich behavioral details.

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 appropriately sized and front-loaded: the first sentence states the purpose, followed by structured sections for Args and Returns. Every sentence adds value without redundancy, making it efficient and easy to parse.

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

Completeness4/5

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

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is mostly complete: it explains the action, parameter, and return value. However, it could benefit from more behavioral context (e.g., error cases or prerequisites) to fully compensate for the lack of annotations and output schema.

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?

With 0% schema description coverage and 1 parameter, the description compensates by explaining the 'name' parameter's purpose and default behavior ('If None, uses the current device'). This adds meaningful semantics beyond the bare schema, though it doesn't detail format constraints or examples.

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 ('stop playback') and resource ('on a Sonos device'), distinguishing it from sibling tools like pause, play, next, and previous. It precisely defines what the tool does without being vague or tautological.

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 by specifying it's for stopping playback on a Sonos device, but it doesn't explicitly state when to use this tool versus alternatives like pause or when not to use it. The context is well-defined, but lacks explicit exclusions or comparisons to siblings.

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