Skip to main content
Glama
fborello

MCP Spotify Server

by fborello

spotify_previous

Return to the previous track in your Spotify playback. Use this tool to navigate back to songs you just heard or restart the current track from the beginning.

Instructions

Volta para a música anterior

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idNoID do dispositivo (opcional)

Implementation Reference

  • The handler function that executes the spotify_previous tool logic by calling skipToPrevious on the Spotify Web API.
    async previous(deviceId?: string) {
      try {
        await this.spotifyAuth.ensureValidToken();
        const spotifyApi = this.spotifyAuth.getSpotifyApi();
    
        const options = deviceId ? { device_id: deviceId } : {};
        await spotifyApi.skipToPrevious(options);
    
        return {
          content: [
            {
              type: 'text',
              text: '⏮️ Voltou para a música anterior',
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `❌ Erro ao voltar música: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • The input schema and tool metadata definition for spotify_previous, registered in the ListTools handler.
    {
      name: 'spotify_previous',
      description: 'Volta para a música anterior',
      inputSchema: {
        type: 'object',
        properties: {
          device_id: {
            type: 'string',
            description: 'ID do dispositivo (opcional)',
          },
        },
      },
    },
  • src/index.ts:283-284 (registration)
    The switch case registration that routes calls to the spotify_previous tool to the SpotifyTools.previous() method.
    case 'spotify_previous':
      return await spotifyTools.previous(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 ('go back to the previous song') but lacks critical details: whether it requires authentication, if it affects playback state (e.g., resumes if paused), what happens if there's no previous song (error or wrap-around), or rate limits. The description is minimal and misses key behavioral traits for a media control tool.

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 with zero wasted words. It is appropriately sized for a simple action tool and front-loaded with the core functionality. Every word earns its place, making it highly concise and well-structured.

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 (simple media control with one optional parameter), no annotations, no output schema, and minimal description, the description is incomplete. It lacks context on authentication needs, error conditions, playback state implications, and interaction with sibling tools (e.g., 'spotify_pause'). For a tool that modifies playback, more behavioral and contextual information is needed to guide the agent effectively.

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 input schema has 1 parameter with 100% coverage (device_id is described as optional device ID). The description adds no parameter-specific information beyond what the schema provides. Since there are 0 parameters mentioned in the description and schema coverage is high, the baseline is 3, but the tool has only one optional parameter, making the lack of param details less critical, warranting a slightly higher score.

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 'Volta para a música anterior' (Portuguese for 'Go back to the previous song') clearly states the tool's action with a specific verb ('volta') and resource ('música anterior'). It distinguishes itself from siblings like 'spotify_next' (go forward) and 'spotify_pause' (pause), but doesn't explicitly differentiate from all siblings (e.g., 'spotify_play' could be ambiguous). The purpose is unambiguous but lacks explicit sibling comparison.

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., requires an active playback session), exclusions (e.g., not applicable if at the start of a playlist), or comparisons to similar tools like 'spotify_next' or 'spotify_play'. Usage is implied from the action alone, leaving the agent to infer context.

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