Skip to main content
Glama
fborello

MCP Spotify Server

by fborello

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
NameRequiredDescriptionDefault
codeYesCódigo de autorização retornado pelo Spotify após login

Implementation Reference

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

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Conclui a autenticação' implies this is a write operation that exchanges an authorization code for tokens, it doesn't disclose what tokens are obtained (access/refresh), where they're stored, whether this requires specific permissions, or what happens on failure. For an authentication tool with zero annotation coverage, this leaves significant behavioral gaps.

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. There's zero wasted language, and it's appropriately sized for a single-parameter tool. Every word earns its place by conveying essential information about completing authentication with a Spotify code.

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?

For an authentication tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what authentication tokens are obtained, how they're stored/used, what the tool returns, or error conditions. Given the complexity of OAuth token exchange and the lack of structured documentation, the description should provide more context about the authentication flow and outcomes.

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

Parameters3/5

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

Schema description coverage is 100%, with the single parameter 'code' well-documented in the schema as 'Código de autorização retornado pelo Spotify após login'. The description adds no additional parameter information beyond what the schema provides. With complete schema coverage, the baseline score of 3 is appropriate as the description doesn't enhance parameter understanding.

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 ('Conclui a autenticação' - Completes authentication) and the resource ('com o código recebido do Spotify' - with the code received from Spotify). It distinguishes from sibling tools like 'spotify_auth' by specifying this is for completing authentication with a code rather than initiating it. However, it doesn't explicitly mention that this is for OAuth token exchange, which would make it more specific.

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. It doesn't mention that this should be used after receiving an authorization code from Spotify's OAuth flow, nor does it clarify the relationship with 'spotify_auth' (which likely initiates authentication). There are no explicit when/when-not instructions or alternative tool recommendations.

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