Skip to main content
Glama
fborello

MCP Spotify Server

by fborello

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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.`,
          },
        ],
      };
    }
  • 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: {},
      },
    },
  • Dispatch handler in CallToolRequestSchema that invokes the spotify_auth implementation.
    case 'spotify_auth':
      return await spotifyTools.authenticate();
  • 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');
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool initiates authentication but doesn't describe what this entails (e.g., opening a browser, returning tokens, requiring user interaction, or handling errors). For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Portuguese that directly states the tool's purpose without any unnecessary words. It is appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of an authentication tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., tokens, URLs, or status), how it interacts with the user, or any behavioral traits like rate limits or errors, leaving the agent with insufficient context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't add parameter details beyond what the schema provides, but with no parameters, a baseline of 4 is appropriate as there's nothing to compensate for.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Inicia o processo de autenticação') and the target resource ('com o Spotify'), making the purpose understandable. It doesn't explicitly differentiate from sibling tools like 'spotify_set_tokens', but the verb 'inicia' suggests starting a process rather than setting tokens directly, which provides some implicit distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'spotify_set_tokens', nor does it mention prerequisites or context for authentication. It implies usage for authentication but lacks explicit when/when-not instructions or references to other tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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