Skip to main content
Glama

now_playing

Retrieve currently playing track details across all Sonos devices, including track name, artist, and album, for real-time monitoring and management.

Instructions

Retrieve information about currently playing tracks on all Sonos devices.

Returns: List[Dict[str, str]]: A list of dictionaries containing the name, title, artist, and album of currently playing tracks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'now_playing' MCP tool. Decorated with @mcp.tool() for automatic registration using FastMCP. It discovers Sonos devices, checks which are playing, and returns a list of dicts with device name, title, artist, and album for currently playing tracks.
    @mcp.tool() def now_playing() -> List[Dict[str, str]]: """Retrieve information about currently playing tracks on all Sonos devices. Returns: List[Dict[str, str]]: A list of dictionaries containing the name, title, artist, and album of currently playing tracks. """ devices = get_devices() infos = [] for device in devices.values(): track = device.get_current_track_info() if not track: continue is_playing = device.get_current_transport_info()["current_transport_state"] == "PLAYING" if is_playing: infos.append({ "name": device.player_name, "title": track["title"], "artist": track["artist"], "album": track["album"] }) return infos

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