spotify_auth
Start Spotify authentication to enable music search, playback control, playlist management, and device operations through natural language commands.
Instructions
Inicia o processo de autenticação com o Spotify
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/spotify-tools.ts:11-36 (handler)Main handler function that executes the logic for the 'spotify_auth' tool: checks authentication status, generates and opens the authorization URL, returns success or instructions.async authenticate() { if (this.spotifyAuth.isAuthenticated()) { return { content: [ { type: 'text', text: '✅ Já autenticado com o Spotify!', }, ], }; } const authUrl = this.spotifyAuth.getAuthorizationUrl(); // Abrir navegador automaticamente await open(authUrl); return { content: [ { type: 'text', text: `🔐 Abra este link no navegador para autenticar com o Spotify:\n\n${authUrl}\n\nApós autorizar, você receberá um código. Use o comando spotify_set_tokens com o código recebido.`, }, ], }; }
- src/index.ts:47-52 (schema)Input schema definition for 'spotify_auth' tool (empty object, no parameters required). Part of the tool registration.name: 'spotify_auth', description: 'Inicia o processo de autenticação com o Spotify', inputSchema: { type: 'object', properties: {}, },
- src/index.ts:46-53 (registration)Registration of the 'spotify_auth' tool in the ListTools response, including name, description, and schema.{ name: 'spotify_auth', description: 'Inicia o processo de autenticação com o Spotify', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:262-264 (handler)Dispatch handler in CallToolRequestSchema that invokes the spotify_auth implementation.case 'spotify_auth': return await spotifyTools.authenticate();
- src/auth/spotify-auth.ts:24-42 (helper)Helper method called by the handler to generate the Spotify OAuth authorization URL with required scopes.getAuthorizationUrl(): string { const scopes = [ 'user-read-private', 'user-read-email', 'user-read-playback-state', 'user-modify-playback-state', 'user-read-currently-playing', 'playlist-read-private', 'playlist-read-collaborative', 'playlist-modify-public', 'playlist-modify-private', 'user-library-read', 'user-library-modify', 'user-top-read', 'user-read-recently-played' ]; return this.spotifyApi.createAuthorizeURL(scopes, 'state'); }