set_repeat_mode
Control Spotify playback repeat settings to loop tracks, playlists, or disable repeat mode using the Spotify MCP server.
Instructions
Set repeat mode for playback
Args:
state: One of 'track', 'context', or 'off'
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | Yes |
Implementation Reference
- main.py:178-186 (handler)The MCP tool handler function for set_repeat_mode, decorated with @mcp.tool(). It defines the input schema via type hints and docstring, registers the tool, and delegates to SpotifyClient.set_repeat(state).@mcp.tool() async def set_repeat_mode(state: str) -> str: """ Set repeat mode for playback Args: state: One of 'track', 'context', or 'off' """ return await client.set_repeat(state)
- spotify.py:295-304 (helper)Supporting utility method in the SpotifyClient class that implements the repeat mode functionality using the underlying spotipy Spotify client.async def set_repeat(self, state: str) -> str: """ Set repeat mode for playback - state: 'track', 'context' or 'off' """ try: self.sp.repeat(state) return f"Repeat mode set to {state}" except Exception as e: return f"Error setting repeat mode: {str(e)}"