Skip to main content
Glama

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
NameRequiredDescriptionDefault
device_idNoID do dispositivo (opcional)

Implementation Reference

  • 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)}`, }, ], }; } }
  • 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);

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/fborello/MCPSpotify'

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