skipToPrevious
Go back to the previous track in your current Spotify playback queue. Control playback by specifying a device ID to skip tracks on your connected Spotify devices.
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-162 (handler)The handler function for the 'skipToPrevious' tool. It extracts the optional deviceId from arguments, uses handleSpotifyRequest to call the Spotify API's skipToPrevious method, and returns a success message.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)The Zod input schema for the 'skipToPrevious' tool, defining an optional string parameter for deviceId.schema: { deviceId: z .string() .optional() .describe('The Spotify device ID to skip on'), },
- src/play.ts:362-371 (registration)The 'skipToPrevious' tool is included in the playTools array, which is exported and later used for registration.export const playTools = [ playMusic, pausePlayback, skipToNext, skipToPrevious, createPlaylist, addTracksToPlaylist, resumePlayback, addToQueue, ];
- src/index.ts:12-14 (registration)Main registration loop in index.ts that registers all tools from playTools (including skipToPrevious) to the MCP server.[...readTools, ...playTools, ...albumTools].forEach((tool) => { server.tool(tool.name, tool.description, tool.schema, tool.handler); });