Skip to main content
Glama

skip_to_previous

Navigate back to replay the previous track or restart the current one from the beginning. Correct accidental skips, replay favorite parts, or manage playback order in Spotify. Requires an active session and Spotify token.

Instructions

Skip to the previous track or restart the current track from the beginning.

🎯 USE CASES: • Go back to replay favorite parts of songs • Navigate backwards through playlists or albums • Correct accidental skips to next track • Replay tracks that were particularly enjoyable • Build comprehensive playback control systems

📝 WHAT IT RETURNS: • Information about the track that started playing • Playback position reset to beginning of track • Updated queue and playback state information • Confirmation of successful skip operation • Device status with new playback details

🔍 EXAMPLES: • "Go back to the previous song" • "Play that last track again" • "Skip back to the song before this one" • "I want to hear that again"

🎵 SKIP BEHAVIOR: • Restarts current track if more than 3 seconds have played • Goes to actual previous track if within first 3 seconds • Follows reverse playlist/album order • Respects shuffle mode for random navigation • Updates position in listening history

⚠️ REQUIREMENTS: • Valid Spotify access token with user-modify-playback-state scope • Active playback session currently running • Previous track must exist in queue or history

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdNoSpotify device ID (optional, uses active device if not specified)
tokenYesSpotify access token for authentication

Implementation Reference

  • MCP tool handler for skip_to_previous that delegates to SpotifyService
    handler: async (args: any, spotifyService: SpotifyService) => { const { token, deviceId } = args; return await spotifyService.skipToPrevious(token, deviceId); },
  • Input schema validation for the skip_to_previous tool
    schema: createSchema({ token: commonSchemas.token(), deviceId: commonSchemas.deviceId(), }),
  • Underlying SpotifyService implementation making API call to skip to previous track
    async skipToPrevious( token: string, deviceId: string | null = null ): Promise<void> { const endpoint = deviceId ? `me/player/previous?device_id=${deviceId}` : "me/player/previous"; return await this.makeRequest<void>(endpoint, token, {}, "POST"); }
  • Registration of playbackTools (including skip_to_previous) into the central allTools registry used by ToolRegistrar
    export const allTools: ToolsRegistry = { ...albumTools, ...artistTools, ...trackTools, ...playlistTools, ...playbackTools, ...userTools, ...searchTools, };
  • ToolRegistrar instantiation in MCP server, enabling dynamic tool listing and execution for skip_to_previous and all tools
    const toolRegistrar = new ToolRegistrar(spotifyService);

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/latiftplgu/Spotify-OAuth-MCP-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server