spotify_set_tokens
Complete Spotify authentication by providing the authorization code received after user login to enable music playback and playlist management.
Instructions
Conclui a autenticação com o código recebido do Spotify
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Código de autorização retornado pelo Spotify após login |
Implementation Reference
- src/tools/spotify-tools.ts:41-62 (handler)The main handler function that takes the authorization code and exchanges it for Spotify access and refresh tokens using SpotifyAuth, returning success or error message.async setTokens(code: string) { try { const tokens = await this.spotifyAuth.exchangeCodeForTokens(code); return { content: [ { type: 'text', text: '✅ Autenticação com Spotify concluída com sucesso!', }, ], }; } catch (error) { return { content: [ { type: 'text', text: `❌ Erro na autenticação: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }
- src/index.ts:54-67 (schema)Input schema for the spotify_set_tokens tool, defining the required 'code' string parameter.{ name: 'spotify_set_tokens', description: 'Conclui a autenticação com o código recebido do Spotify', inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'Código de autorização retornado pelo Spotify após login', }, }, required: ['code'], }, },
- src/index.ts:265-266 (registration)Tool dispatch registration in the CallToolRequestSchema handler switch statement, routing calls to spotifyTools.setTokens.case 'spotify_set_tokens': return await spotifyTools.setTokens(args.code);