Skip to main content
Glama

set_volume

Adjust the volume level on your active Spotify device by setting a percentage from 0 to 100, enabling precise audio control during playback.

Instructions

Adjust the volume level for the user's active Spotify device.

🎯 USE CASES: • Create dynamic volume adjustments for different times of day • Build smart home automation with volume control • Implement voice commands for hands-free volume changes • Adjust volume based on ambient noise levels • Create custom audio experience controls

📝 WHAT IT RETURNS: • Confirmation of successful volume change • Current volume level after adjustment • Device information showing updated state • Previous volume level for potential undo functionality • Playback state with new volume settings

🔍 EXAMPLES: • "Set volume to 50%" • "Lower the volume to 25" • "Turn up the music to 80%" • "Make it quieter, set to 15%"

🔊 VOLUME CONTROL: • Range: 0-100 percent • 0 = Complete silence (muted) • 100 = Maximum device volume • Changes apply instantly during playback • Preserves volume setting for future sessions

⚠️ REQUIREMENTS: • Valid Spotify access token with user-modify-playback-state scope • Active device that supports volume control • Device must be currently available and responsive

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
volume_percentYesVolume level as a percentage (0-100)
deviceIdNoSpotify device ID (optional, uses active device if not specified)

Implementation Reference

  • Core handler implementation in SpotifyService that clamps the volume percent to 0-100 and makes a PUT request to Spotify API endpoint /me/player/volume?volume_percent={volume}[&device_id={deviceId}] to set the volume on the specified or active device.
    async setVolume(
      token: string,
      volumePercent: number,
      deviceId: string | null = null
    ): Promise<void> {
      const volume = Math.min(Math.max(volumePercent, 0), 100);
      let endpoint = `me/player/volume?volume_percent=${volume}`;
      if (deviceId) {
        endpoint += `&device_id=${deviceId}`;
      }
      return await this.makeRequest<void>(endpoint, token, {}, "PUT");
    }
  • MCP tool registration for 'set_volume' including title, description, input schema, and handler that delegates to SpotifyService.setVolume.
      set_volume: {
        title: "Set Player Volume",
        description: `Adjust the volume level for the user's active Spotify device.
    
    🎯 USE CASES:
    • Create dynamic volume adjustments for different times of day
    • Build smart home automation with volume control
    • Implement voice commands for hands-free volume changes
    • Adjust volume based on ambient noise levels
    • Create custom audio experience controls
    
    📝 WHAT IT RETURNS:
    • Confirmation of successful volume change
    • Current volume level after adjustment
    • Device information showing updated state
    • Previous volume level for potential undo functionality
    • Playback state with new volume settings
    
    🔍 EXAMPLES:
    • "Set volume to 50%"
    • "Lower the volume to 25"
    • "Turn up the music to 80%"
    • "Make it quieter, set to 15%"
    
    🔊 VOLUME CONTROL:
    • Range: 0-100 percent
    • 0 = Complete silence (muted)
    • 100 = Maximum device volume
    • Changes apply instantly during playback
    • Preserves volume setting for future sessions
    
    ⚠️ REQUIREMENTS:
    • Valid Spotify access token with user-modify-playback-state scope
    • Active device that supports volume control
    • Device must be currently available and responsive`,
        schema: createSchema({
          token: commonSchemas.token(),
          volume_percent: commonSchemas.volumePercent(),
          deviceId: commonSchemas.deviceId(),
        }),
        handler: async (args: any, spotifyService: SpotifyService) => {
          const { token, volume_percent, deviceId } = args;
          return await spotifyService.setVolume(token, volume_percent, deviceId);
        },
      },
  • Input schema definition for the set_volume tool using Zod validation for token, volume_percent (0-100), and optional deviceId.
      token: commonSchemas.token(),
      volume_percent: commonSchemas.volumePercent(),
      deviceId: commonSchemas.deviceId(),
    }),
  • Reusable Zod schema helper for volume_percent parameter, enforcing 0-100 integer range with description.
    volumePercent: () =>
      z.number().min(0).max(100).describe("Volume level as a percentage (0-100)"),
Behavior5/5

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

With no annotations provided, the description carries full burden and delivers comprehensive behavioral disclosure. It details what the tool returns (confirmation, current volume, device info), how volume changes behave (instantly during playback, preserves for future sessions), and specific requirements (authentication scope, device availability).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (USE CASES, WHAT IT RETURNS, etc.), but it's quite lengthy with multiple bullet points that could be more streamlined. While informative, some redundancy exists (e.g., examples reiterate what the tool does).

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

Completeness5/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 exceptional completeness. It covers purpose, usage scenarios, return values, parameter semantics, examples, behavioral details, and requirements - leaving no significant gaps for the agent to understand and invoke this tool correctly.

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?

Schema description coverage is 100%, so the baseline is 3. The description adds significant value beyond the schema by explaining the volume_percent parameter's meaning in the 'VOLUME CONTROL' section (0=complete silence, 100=maximum, range context) and providing practical examples that illustrate parameter usage.

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 tool's purpose with a specific verb ('Adjust') and resource ('volume level for the user's active Spotify device'), distinguishing it from all sibling tools which focus on playback control, content retrieval, or playlist management rather than volume adjustment.

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

Usage Guidelines5/5

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

The description explicitly provides when-to-use guidance through the 'USE CASES' section (e.g., dynamic adjustments, smart home automation) and 'REQUIREMENTS' section (valid token with specific scope, active device). It also distinguishes from siblings by focusing solely on volume control.

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/latiftplgu/Spotify-OAuth-MCP-server'

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