spotify_previous
Return to the previous track in your Spotify playback. Use this tool to navigate back to songs you just heard or restart the current track from the beginning.
Instructions
Volta para a música anterior
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_id | No | ID do dispositivo (opcional) |
Implementation Reference
- src/tools/spotify-tools.ts:275-301 (handler)The handler function that executes the spotify_previous tool logic by calling skipToPrevious on the Spotify Web API.async previous(deviceId?: string) { try { await this.spotifyAuth.ensureValidToken(); const spotifyApi = this.spotifyAuth.getSpotifyApi(); const options = deviceId ? { device_id: deviceId } : {}; await spotifyApi.skipToPrevious(options); return { content: [ { type: 'text', text: '⏮️ Voltou para a música anterior', }, ], }; } catch (error) { return { content: [ { type: 'text', text: `❌ Erro ao voltar música: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }
- src/index.ts:148-160 (schema)The input schema and tool metadata definition for spotify_previous, registered in the ListTools handler.{ name: 'spotify_previous', description: 'Volta para a música anterior', inputSchema: { type: 'object', properties: { device_id: { type: 'string', description: 'ID do dispositivo (opcional)', }, }, }, },
- src/index.ts:283-284 (registration)The switch case registration that routes calls to the spotify_previous tool to the SpotifyTools.previous() method.case 'spotify_previous': return await spotifyTools.previous(args.device_id);