skipToPrevious
Navigate to the previous track in your current Spotify playback queue. Control playback by specifying a device ID to skip tracks during music listening sessions.
Instructions
Skip to the previous track in the current Spotify playback queue
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | No | The Spotify device ID to skip on |
Implementation Reference
- src/play.ts:146-161 (handler)The handler function for the skipToPrevious tool, which calls the Spotify API to skip to the previous track.handler: async (args, _extra: SpotifyHandlerExtra) => { const { deviceId } = args; await handleSpotifyRequest(async (spotifyApi) => { await spotifyApi.player.skipToPrevious(deviceId || ''); }); return { content: [ { type: 'text', text: 'Skipped to previous track', }, ], }; },
- src/play.ts:140-145 (schema)Input schema for the skipToPrevious tool using Zod, defining optional deviceId.schema: { deviceId: z .string() .optional() .describe('The Spotify device ID to skip on'), },
- src/play.ts:499-510 (registration)The skipToPrevious tool is registered in the playTools export array.export const playTools = [ playMusic, pausePlayback, skipToNext, skipToPrevious, createPlaylist, addTracksToPlaylist, resumePlayback, addToQueue, setVolume, adjustVolume, ];