Skip to main content
Glama
igorgarbuz

Spotify MCP Node Server

by igorgarbuz

playbackAction

Control Spotify playback by pausing, resuming, or skipping tracks through the Spotify MCP Node Server. Manage music playback actions with specific device targeting.

Instructions

Perform a playback action (pause, resume, skip to next, skip to previous)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe playback action to perform
deviceIdNoThe Spotify device ID to perform the action on

Implementation Reference

  • Handler function for the playbackAction tool that performs the specified playback control action (pause, resume, skip next/previous) on Spotify.
    handler: async (args, extra: SpotifyHandlerExtra) => {
      const { action, deviceId } = args;
    
      let successMessage = '';
    
      await handleSpotifyRequest(async (spotifyApi) => {
        const device = deviceId || '';
        switch (action) {
          case 'pause':
            await spotifyApi.player.pausePlayback(device);
            successMessage = 'Playback paused';
            break;
          case 'resume':
            await spotifyApi.player.startResumePlayback(device);
            successMessage = 'Playback resumed';
            break;
          case 'skipToNext':
            await spotifyApi.player.skipToNext(device);
            successMessage = 'Skipped to next track';
            break;
          case 'skipToPrevious':
            await spotifyApi.player.skipToPrevious(device);
            successMessage = 'Skipped to previous track';
            break;
        }
      });
    
      return {
        content: [
          {
            type: 'text',
            text: successMessage,
          },
        ],
      };
    },
  • Zod input schema for playbackAction tool defining 'action' (required enum) and optional 'deviceId'.
    schema: {
      action: z
        .enum(['pause', 'skipToNext', 'skipToPrevious', 'resume'])
        .describe('The playback action to perform'),
      deviceId: z
        .string()
        .optional()
        .describe('The Spotify device ID to perform the action on'),
    },
  • src/player.ts:130-130 (registration)
    playbackAction is added to playTools array for export and subsequent registration.
    export const playTools = [playMusic, playbackAction];
  • src/index.ts:12-14 (registration)
    playTools (including playbackAction) are registered with the MCP server via server.tool calls.
    [...playTools, ...readTools, ...writeTools].forEach((tool) => {
      server.tool(tool.name, tool.description, tool.schema, tool.handler);
    });
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states what the tool does (perform actions) but lacks behavioral details: doesn't specify if it requires authentication, affects playback state globally, has rate limits, or what happens on success/failure. 'Perform' implies mutation, but no safety or side-effect information is given.

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 that front-loads the purpose and lists actions. Every word earns its place with no redundancy or fluff. Structure is straightforward 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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects (auth, side effects), success/failure responses, or usage context. While concise, it lacks necessary context for safe and effective use by an agent.

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 parameter descriptions in the schema. The description adds minimal value beyond schema: it lists action options (already in enum) and implies device targeting but doesn't explain parameter interactions or semantics (e.g., deviceId optionality, action effects). Baseline 3 is appropriate as schema does heavy lifting.

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 verb ('perform') and resource ('playback action'), listing specific actions (pause, resume, skip to next, skip to previous). It distinguishes from siblings by focusing on playback control rather than queue management, playlist operations, or music playback initiation. However, it doesn't explicitly differentiate from 'playMusic' which might overlap in controlling playback.

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 'playMusic' (which might start playback) or 'addToQueue' (which modifies queue). It doesn't mention prerequisites (e.g., requires active playback, device selection) or exclusions. Usage is implied through action names but not explicitly stated.

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/igorgarbuz/spotify-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server