Skip to main content
Glama

get_current_track_info

Fetch real-time track details from a Sonos device, including artist, title, album, position, and duration. Specify the device name or retrieve data from the currently active one.

Instructions

Retrieve current track information for a Sonos device.

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

Returns: Dict[str, str]: A dictionary containing the current track's artist, title, album, playlist position, and duration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo

Implementation Reference

  • The handler function decorated with @mcp.tool(), implementing the logic to retrieve and format the current track information from the Sonos device.
    def get_current_track_info(name: Optional[str] = None) -> Dict[str, str]:
        """Retrieve current track information for a Sonos device.
        
        Args:
            name: The name of the device to retrieve track information from. If None, uses the current device.
            
        Returns:
            Dict[str, str]: A dictionary containing the current track's artist, title, album, playlist position, and duration.
        """
        track = get_device(name).get_current_track_info()
        return {
            "artist": track['artist'],
            "title": track['title'],
            "album": track['album'],
            "playlist_position": track['playlist_position'],
            "duration": track['duration']
        }
  • Helper function used by the tool to get the Sonos device instance by name or default.
    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")
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it 'retrieves' information without disclosing behavioral traits. It doesn't mention whether this requires specific permissions, has rate limits, what happens if no track is playing, or if it affects device state. For a read operation with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior.

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

Conciseness4/5

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

The description is well-structured with clear sections (purpose, args, returns) and uses minimal sentences that each add value. The Args and Returns sections are appropriately detailed without redundancy. It could be slightly more concise by integrating the default behavior into the main description rather than a separate Args note.

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?

For a single-parameter read tool with no annotations and no output schema, the description adequately covers the basic purpose and parameters. However, it lacks information about error conditions, what happens when no track is playing, or the format of duration values. The return format description ('Dict[str, str]') is helpful but doesn't fully substitute for an output schema.

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?

The description adds substantial value beyond the input schema, which has 0% description coverage. It explains the 'name' parameter's purpose ('The name of the device to retrieve track information from'), default behavior ('If None, uses the current device'), and clarifies this is an optional parameter. This fully compensates for the schema's lack of parameter documentation.

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 current track information'), target resource ('for a Sonos device'), and distinguishes from siblings like get_queue (which retrieves queue content) or now_playing (which might show status without structured data). It explicitly identifies what information is retrieved: artist, title, album, playlist position, and duration.

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

Usage Guidelines3/5

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

The description implies usage when current track details are needed, but doesn't explicitly state when to use this versus alternatives like now_playing or get_device_state. It mentions the default behavior (uses current device if name is None) which provides some context, but lacks explicit guidance on tool selection among 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