Skip to main content
Glama
fborello

MCP Spotify Server

by fborello

spotify_play_playlist

Play a specific Spotify playlist by providing its ID to start music playback on your preferred device.

Instructions

Toca uma playlist específica

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idNoID do dispositivo (opcional)
playlist_idYesID da playlist no Spotify

Implementation Reference

  • The handler function that executes the logic to play a specific Spotify playlist using the Spotify API's play method with context_uri.
    async playPlaylist(playlistId: string, deviceId?: string) {
      try {
        await this.spotifyAuth.ensureValidToken();
        const spotifyApi = this.spotifyAuth.getSpotifyApi();
    
        const options: any = { context_uri: `spotify:playlist:${playlistId}` };
        if (deviceId) {
          options.device_id = deviceId;
        }
    
        await spotifyApi.play(options);
    
        return {
          content: [
            {
              type: 'text',
              text: `▶️ Tocando playlist com ID: ${playlistId}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `❌ Erro ao tocar playlist: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • Input schema definition for the spotify_play_playlist tool, specifying parameters playlist_id (required) and optional device_id.
    {
      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'],
      },
    },
  • src/index.ts:295-296 (registration)
    Registration in the CallToolRequest handler switch statement, dispatching to the playPlaylist method on SpotifyTools instance.
    case 'spotify_play_playlist':
      return await spotifyTools.playPlaylist(args.playlist_id, args.device_id);
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 ('play') but lacks critical details: it doesn't specify if this starts playback from the beginning, requires an active Spotify session, affects other playback, or has side effects like changing device context. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 unnecessary words. It's front-loaded and wastes no space, making it highly concise and well-structured for quick understanding.

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's complexity (a mutation action with no annotations and no output schema), the description is incomplete. It doesn't cover behavioral aspects like authentication needs, playback effects, or error conditions, and it lacks output information. For a tool that likely interacts with an external service and changes state, this minimal description is insufficient.

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 clear descriptions for both parameters (playlist_id as required, device_id as optional). The description adds no additional meaning beyond the schema, such as format examples or usage context for device_id. Baseline 3 is appropriate since the schema adequately documents the parameters.

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 'Toca uma playlist específica' (Plays a specific playlist) clearly states the verb (play) and resource (playlist), making the purpose immediately understandable. However, it doesn't differentiate from siblings like 'spotify_play' (which likely plays something else) or 'spotify_resume' (which might resume playback), so it doesn't reach the highest 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 doesn't mention prerequisites (e.g., authentication, active device), exclusions, or comparisons to siblings like 'spotify_play' or 'spotify_resume', 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