Skip to main content
Glama
fborello

MCP Spotify Server

by fborello

spotify_devices

List available playback devices connected to your Spotify account to manage where music plays from.

Instructions

Lista dispositivos disponíveis para reprodução

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for 'spotify_devices' tool. Ensures valid token, fetches available devices via SpotifyWebApi's getMyDevices(), formats and returns a markdown list of devices with details like ID, status, volume.
    async getDevices() {
      try {
        await this.spotifyAuth.ensureValidToken();
        const spotifyApi = this.spotifyAuth.getSpotifyApi();
    
        const response = await spotifyApi.getMyDevices();
        const devices = response.body.devices;
    
        if (devices.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: '❌ Nenhum dispositivo encontrado. Certifique-se de que o Spotify está aberto em algum dispositivo.',
              },
            ],
          };
        }
    
        let content = `📱 **Dispositivos disponíveis:**\n\n`;
        devices.forEach((device: any, index: number) => {
          const status = device.is_active ? '🟢 Ativo' : '⚪ Inativo';
          content += `${index + 1}. **${device.name}** (${device.type})\n`;
          content += `   ID: ${device.id}\n`;
          content += `   Status: ${status}\n`;
          content += `   Volume: ${device.volume_percent}%\n\n`;
        });
    
        return {
          content: [
            {
              type: 'text',
              text: content,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `❌ Erro ao obter dispositivos: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • src/index.ts:169-176 (registration)
    Registration of the 'spotify_devices' tool in the ListToolsRequestHandler, including name, description, and empty input schema (no parameters required).
    {
      name: 'spotify_devices',
      description: 'Lista dispositivos disponíveis para reprodução',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Dispatch case in the CallToolRequestHandler switch statement that invokes the spotifyTools.getDevices() handler.
    case 'spotify_devices':
      return await spotifyTools.getDevices();
  • TypeScript interface defining the structure of a SpotifyDevice, used implicitly in the tool's output processing.
    export interface SpotifyDevice {
      id: string;
      is_active: boolean;
      is_private_session: boolean;
      is_restricted: boolean;
      name: string;
      type: string;
      volume_percent: number;
    }
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. It states the tool lists devices but does not describe what the list includes (e.g., device names, types, status), how it's formatted, whether it requires authentication, or any rate limits. This is a significant gap for a tool with zero annotation coverage.

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 ('Lista dispositivos disponíveis para reprodução') that directly states the tool's function without any wasted words. It is appropriately sized and front-loaded, making it highly efficient.

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 lack of annotations and output schema, the description is incomplete. It does not explain what the output looks like (e.g., list format, device attributes), behavioral aspects like authentication requirements, or how it integrates with sibling tools (e.g., used before 'spotify_play'). For a tool in a complex Spotify API context, this leaves critical gaps.

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, and schema description coverage is 100%, so there is no need for parameter details in the description. The baseline for 0 parameters is 4, as the description appropriately avoids unnecessary parameter information and focuses on the tool's purpose.

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 'Lista dispositivos disponíveis para reprodução' clearly states the tool's purpose as listing available playback devices, using specific verbs ('Lista') and resources ('dispositivos'). However, it does not explicitly differentiate from sibling tools like 'spotify_play' or 'spotify_pause', which are control tools rather than listing tools, so it falls short of a perfect score.

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 does not mention prerequisites (e.g., authentication status), scenarios for use (e.g., before selecting a device for playback), or exclusions, leaving the agent to infer usage from context alone.

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