Skip to main content
Glama
fborello

MCP Spotify Server

by fborello

spotify_pause

Pause current Spotify playback on your device. Use this tool to temporarily stop music or podcasts during your listening session.

Instructions

Pausa a reprodução atual

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idNoID do dispositivo (opcional)

Implementation Reference

  • The `pause` method in the `SpotifyTools` class implements the core logic for the `spotify_pause` tool. It ensures a valid token, calls the Spotify API to pause playback on the specified or active device, and returns a success or error message.
    async pause(deviceId?: string) {
      try {
        await this.spotifyAuth.ensureValidToken();
        const spotifyApi = this.spotifyAuth.getSpotifyApi();
    
        const options = deviceId ? { device_id: deviceId } : {};
        await spotifyApi.pause(options);
    
        return {
          content: [
            {
              type: 'text',
              text: '⏸️ Reprodução pausada',
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `❌ Erro ao pausar: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • The input schema definition for the `spotify_pause` tool, specifying an optional `device_id` parameter.
    {
      name: 'spotify_pause',
      description: 'Pausa a reprodução atual',
      inputSchema: {
        type: 'object',
        properties: {
          device_id: {
            type: 'string',
            description: 'ID do dispositivo (opcional)',
          },
        },
      },
    },
  • src/index.ts:274-275 (registration)
    The switch case in the `CallToolRequestSchema` handler that routes calls to the `spotify_pause` tool to the `SpotifyTools.pause` method.
    case 'spotify_pause':
      return await spotifyTools.pause(args.device_id);
  • src/index.ts:43-253 (registration)
    The `ListToolsRequestSchema` handler registers the `spotify_pause` tool by including it in the list of available tools with its schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: 'spotify_auth',
            description: 'Inicia o processo de autenticação com o Spotify',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
          {
            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'],
            },
          },
          {
            name: 'spotify_search',
            description: 'Busca por músicas, artistas, álbuns ou playlists no Spotify',
            inputSchema: {
              type: 'object',
              properties: {
                query: {
                  type: 'string',
                  description: 'Termo de busca (nome da música, artista, etc.)',
                },
                type: {
                  type: 'string',
                  enum: ['track', 'artist', 'album', 'playlist'],
                  description: 'Tipo de conteúdo para buscar',
                },
                limit: {
                  type: 'number',
                  description: 'Número máximo de resultados (padrão: 20)',
                },
              },
              required: ['query', 'type'],
            },
          },
          {
            name: 'spotify_play',
            description: 'Toca uma música específica no Spotify',
            inputSchema: {
              type: 'object',
              properties: {
                track_id: {
                  type: 'string',
                  description: 'ID da música no Spotify',
                },
                device_id: {
                  type: 'string',
                  description: 'ID do dispositivo (opcional)',
                },
              },
              required: ['track_id'],
            },
          },
          {
            name: 'spotify_pause',
            description: 'Pausa a reprodução atual',
            inputSchema: {
              type: 'object',
              properties: {
                device_id: {
                  type: 'string',
                  description: 'ID do dispositivo (opcional)',
                },
              },
            },
          },
          {
            name: 'spotify_resume',
            description: 'Retoma a reprodução pausada',
            inputSchema: {
              type: 'object',
              properties: {
                device_id: {
                  type: 'string',
                  description: 'ID do dispositivo (opcional)',
                },
              },
            },
          },
          {
            name: 'spotify_next',
            description: 'Pula para a próxima música',
            inputSchema: {
              type: 'object',
              properties: {
                device_id: {
                  type: 'string',
                  description: 'ID do dispositivo (opcional)',
                },
              },
            },
          },
          {
            name: 'spotify_previous',
            description: 'Volta para a música anterior',
            inputSchema: {
              type: 'object',
              properties: {
                device_id: {
                  type: 'string',
                  description: 'ID do dispositivo (opcional)',
                },
              },
            },
          },
          {
            name: 'spotify_current_playing',
            description: 'Obtém informações sobre a música que está tocando',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
          {
            name: 'spotify_devices',
            description: 'Lista dispositivos disponíveis para reprodução',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
          {
            name: 'spotify_playlists',
            description: 'Lista playlists do usuário',
            inputSchema: {
              type: 'object',
              properties: {
                limit: {
                  type: 'number',
                  description: 'Número máximo de playlists (padrão: 20)',
                },
              },
            },
          },
          {
            name: 'spotify_play_playlist',
            description: 'Toca uma playlist específica',
            inputSchema: {
              type: 'object',
              properties: {
                playlist_id: {
                  type: 'string',
                  description: 'ID da playlist no Spotify',
                },
                device_id: {
                  type: 'string',
                  description: 'ID do dispositivo (opcional)',
                },
              },
              required: ['playlist_id'],
            },
          },
          {
            name: 'spotify_create_playlist',
            description: 'Cria uma nova playlist no Spotify',
            inputSchema: {
              type: 'object',
              properties: {
                name: {
                  type: 'string',
                  description: 'Nome da playlist',
                },
                description: {
                  type: 'string',
                  description: 'Descrição da playlist (opcional)',
                },
                public: {
                  type: 'boolean',
                  description: 'Se a playlist deve ser pública (padrão: false)',
                },
              },
              required: ['name'],
            },
          },
          {
            name: 'spotify_add_tracks_to_playlist',
            description: 'Adiciona músicas a uma playlist existente',
            inputSchema: {
              type: 'object',
              properties: {
                playlist_id: {
                  type: 'string',
                  description: 'ID da playlist no Spotify',
                },
                track_ids: {
                  type: 'array',
                  items: {
                    type: 'string',
                  },
                  description: 'Array com os IDs das músicas para adicionar',
                },
              },
              required: ['playlist_id', 'track_ids'],
            },
          },
        ],
      };
    });
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 action ('Pausa') but doesn't describe effects (e.g., pauses playback on a device, requires Spotify Premium, may fail if no active playback), permissions, or response behavior. The description is minimal and lacks necessary context for a mutation tool.

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, clear sentence in Portuguese ('Pausa a reprodução atual') that directly states the tool's purpose with zero wasted words. It's front-loaded and appropriately sized for a simple action, making it highly efficient and easy to parse.

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 tool is a mutation (pause action) with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., what happens on success/failure, requirements like active playback), making it inadequate for safe and effective use by an AI agent. The simplicity of the action doesn't excuse the missing context.

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?

The schema description coverage is 100%, with the single parameter 'device_id' documented as optional and a string. The description adds no parameter information beyond what the schema provides. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't need to given the schema's completeness.

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 'Pausa a reprodução atual' clearly states the action (pause) and target (current playback) in Portuguese. It's specific about what the tool does, though it doesn't explicitly differentiate from sibling tools like 'spotify_resume' beyond the obvious action difference. The purpose is unambiguous but lacks explicit sibling comparison.

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 prerequisites (e.g., requires active playback), exclusions, or comparisons to siblings like 'spotify_resume' or 'spotify_play'. Usage is implied from the action name alone, with no contextual instructions.

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