Skip to main content
Glama
marcelmarais

Spotify MCP Server

by marcelmarais

setVolume

Adjust Spotify playback volume to a specific percentage between 0 and 100. Requires Spotify Premium account and device ID for targeted control.

Instructions

Set the playback volume to a specific percentage (0-100). Requires Spotify Premium.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
volumePercentYesThe volume to set (0-100)
deviceIdNoThe Spotify device ID to set volume on

Implementation Reference

  • The async handler function that destructures args, calls handleSpotifyRequest to invoke spotifyApi.player.setPlaybackVolume with the rounded volumePercent on the optional deviceId, returns success message or error.
    handler: async (args, _extra: SpotifyHandlerExtra) => {
      const { volumePercent, deviceId } = args;
    
      try {
        await handleSpotifyRequest(async (spotifyApi) => {
          await spotifyApi.player.setPlaybackVolume(
            Math.round(volumePercent),
            deviceId || '',
          );
        });
    
        return {
          content: [
            {
              type: 'text',
              text: `Volume set to ${Math.round(volumePercent)}%`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error setting volume: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
        };
      }
    },
  • Zod input schema validating volumePercent as a number between 0 and 100, and optional deviceId string.
    schema: {
      volumePercent: z
        .number()
        .min(0)
        .max(100)
        .describe('The volume to set (0-100)'),
      deviceId: z
        .string()
        .optional()
        .describe('The Spotify device ID to set volume on'),
    },
  • src/play.ts:499-510 (registration)
    The setVolume tool is registered by being included in the exported playTools array, which collects all playback-related MCP tools.
    export const playTools = [
      playMusic,
      pausePlayback,
      skipToNext,
      skipToPrevious,
      createPlaylist,
      addTracksToPlaylist,
      resumePlayback,
      addToQueue,
      setVolume,
      adjustVolume,
    ];
Behavior3/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 mentions the Spotify Premium requirement but doesn't describe what happens if no device is specified (deviceId is optional), whether changes are immediate, or what happens on failure. The description provides basic context but lacks operational details.

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 perfectly concise - a single sentence that communicates the core purpose and key constraint. Every word earns its place with no redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/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 provides basic purpose and constraints but lacks information about return values, error conditions, or device selection behavior when deviceId is omitted. Given the complexity of volume control across devices, more context would be helpful.

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%, so the schema already fully documents both parameters. The description mentions 'percentage (0-100)' which aligns with the schema's volumePercent documentation but adds no additional semantic context beyond what the structured schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Set the playback volume') and the resource ('to a specific percentage'), with precise boundaries (0-100). It distinguishes from sibling 'adjustVolume' by specifying exact percentage setting rather than relative adjustment.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states 'Requires Spotify Premium' which provides important context about prerequisites. However, it doesn't specify when to use this versus the sibling 'adjustVolume' tool for relative volume changes, leaving some ambiguity about tool selection.

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

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