Skip to main content
Glama

remove_index_from_queue

Remove a specific track from a Sonos device queue by specifying its index. Ensures quick updates to the playback list and corrects queue management. Requires the track index and optional device name.

Instructions

Remove a specific track from the queue on a Sonos device.

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

Returns: List[Dict[str, Any]]: The updated queue after removing the track.

Raises: ValueError: If the index is out of the queue's range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYes
nameNo

Implementation Reference

  • The core handler function for the 'remove_index_from_queue' tool. Decorated with @mcp.tool() which also handles registration in FastMCP. It retrieves the Sonos device coordinator, validates the index, removes the track using soco API, and returns the updated queue via get_queue.
    @mcp.tool()
    def remove_index_from_queue(index: int, name: Optional[str] = None) -> List[Dict[str, Any]]:
        """Remove a specific track from the queue on a Sonos device.
        
        Args:
            index: The index of the track to remove.
            name: The name of the device to remove the track from. If None, uses the current device.
            
        Returns:
            List[Dict[str, Any]]: The updated queue after removing the track.
            
        Raises:
            ValueError: If the index is out of the queue's range.
        """
        sonos = get_device(name).group.coordinator
        queue_length = sonos.queue_size
        
        if not 1 <= index <= queue_length:
            raise ValueError(f"Index {index} is not within range 1-{queue_length}")
        
        sonos.remove_from_queue(index)
        # Return the updated queue
        return get_queue(name)

Tool Definition Quality

Score is being calculated. Check back soon.

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