play
Initiate playback on a specified Sonos device or the current device. Returns device state details including volume, track info, and playback status for monitoring and control.
Instructions
Start playback on a Sonos device.
Args: name: The name of the device to start playback on. If None, uses the current device.
Returns: Dict[str, Any]: The device's state after starting playback, including name, volume, state, and track info.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "play"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No |
Implementation Reference
- server.py:171-183 (handler)The implementation of the 'play' MCP tool. It is decorated with @mcp.tool() for registration and executes the playback logic by calling device.play() on the selected Sonos device, then returns the updated device information.
@mcp.tool() def play(name: Optional[str] = None) -> Dict[str, Any]: """Start playback on a Sonos device. Args: name: The name of the device to start playback on. If None, uses the current device. Returns: Dict[str, Any]: The device's state after starting playback, including name, volume, state, and track info. """ device = get_device(name) device.play() return get_info_from(device)