skipToPrevious
Skip back to the previous track in your Spotify playback queue by specifying the device ID through the Spotify MCP Server, enabling precise playback control.
Instructions
Skip to the previous track in the current Spotify playback queue
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | No | The Spotify device ID to skip on |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"deviceId": {
"description": "The Spotify device ID to skip on",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/play.ts:146-161 (handler)The handler function for the 'skipToPrevious' tool. It extracts the optional deviceId from args, calls handleSpotifyRequest to invoke spotifyApi.player.skipToPrevious on the specified or default device, 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 'deviceId' string parameter.schema: { deviceId: z .string() .optional() .describe('The Spotify device ID to skip on'), },
- src/play.ts:362-371 (registration)The 'skipToPrevious' tool is registered by inclusion in the exported 'playTools' array.export const playTools = [ playMusic, pausePlayback, skipToNext, skipToPrevious, createPlaylist, addTracksToPlaylist, resumePlayback, addToQueue, ];
- src/index.ts:12-14 (registration)Final registration of all tools (including 'skipToPrevious' via playTools) on the MCP server instance.[...readTools, ...playTools, ...albumTools].forEach((tool) => { server.tool(tool.name, tool.description, tool.schema, tool.handler); });