Skip to main content
Glama

skip

Skip tracks in the queue for a Sonos device by specifying the number of tracks to advance and the device name. Returns the updated device state, including track, volume, and playback details.

Instructions

Skip tracks in the queue for a Sonos device.

Args: increment: The number of tracks to skip forward. Defaults to 1. name: The name of the device to skip tracks on. If None, uses the current device.

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

Raises: ValueError: If the new track position is out of the queue's range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
incrementNo
nameNo

Implementation Reference

  • The handler function for the 'skip' tool, decorated with @mcp.tool() for registration. It skips a specified number of tracks in the Sonos queue by calculating the new index and calling play_from_queue.
    @mcp.tool() def skip(increment: int = 1, name: Optional[str] = None) -> Dict[str, Any]: """Skip tracks in the queue for a Sonos device. Args: increment: The number of tracks to skip forward. Defaults to 1. name: The name of the device to skip tracks on. If None, uses the current device. Returns: Dict[str, Any]: The device's state after skipping tracks, including name, volume, state, and track info. Raises: ValueError: If the new track position is out of the queue's range. """ sonos = get_device(name) current = int(sonos.get_current_track_info()['playlist_position']) new_index = current + increment queue_length = sonos.queue_size if not 0 <= new_index < queue_length: raise ValueError(f"Cannot skip to position {new_index}") sonos.play_from_queue(new_index) return get_info_from(sonos)
  • Input schema defined by function parameters (increment: int default 1, name: Optional[str]) and output type Dict[str, Any]. Docstring provides detailed description for MCP tool schema.
    def skip(increment: int = 1, name: Optional[str] = None) -> Dict[str, Any]: """Skip tracks in the queue for a Sonos device. Args: increment: The number of tracks to skip forward. Defaults to 1. name: The name of the device to skip tracks on. If None, uses the current device. Returns: Dict[str, Any]: The device's state after skipping tracks, including name, volume, state, and track info.
  • server.py:317-317 (registration)
    The @mcp.tool() decorator registers the skip function as an MCP tool.
    @mcp.tool()

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