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)
Behavior4/5

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

With no annotations provided, the description carries full burden and does well: it discloses the mutation nature ('Remove'), error conditions ('Raises: ValueError if index out of range'), and return format ('List[Dict[str, Any]]: The updated queue'). However, it misses details like side effects (e.g., playback impact) or rate limits.

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 (Args, Returns, Raises) and front-loaded purpose. It's appropriately sized but could be slightly more concise by integrating the parameter details into the main text rather than separate headings.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is fairly complete: it covers purpose, parameters, returns, and errors. However, it lacks details on behavioral traits like whether removal affects playback or requires specific device states, leaving minor gaps.

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?

Schema description coverage is 0%, so the description must compensate fully. It explains both parameters: 'index' as 'The index of the track to remove' and 'name' with its default behavior ('If None, uses the current device'). This adds crucial meaning beyond the bare schema types.

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 ('Remove a specific track'), the target resource ('from the queue on a Sonos device'), and distinguishes it from siblings like 'get_queue' (which reads) or 'play_index' (which plays). The verb+resource combination is precise and unambiguous.

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 needing to delete a track from a queue, but provides no explicit guidance on when to use this versus alternatives (e.g., 'skip' or 'next' for playback control) or prerequisites (e.g., requires an active queue). It mentions the 'name' parameter default but lacks broader contextual advice.

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