Skip to main content
Glama

skip_to_previous

Navigate to the previous track or restart the current song from the beginning in Spotify playback.

Instructions

Skip to the previous track or restart the current track from the beginning.

🎯 USE CASES: • Go back to replay favorite parts of songs • Navigate backwards through playlists or albums • Correct accidental skips to next track • Replay tracks that were particularly enjoyable • Build comprehensive playback control systems

📝 WHAT IT RETURNS: • Information about the track that started playing • Playback position reset to beginning of track • Updated queue and playback state information • Confirmation of successful skip operation • Device status with new playback details

🔍 EXAMPLES: • "Go back to the previous song" • "Play that last track again" • "Skip back to the song before this one" • "I want to hear that again"

🎵 SKIP BEHAVIOR: • Restarts current track if more than 3 seconds have played • Goes to actual previous track if within first 3 seconds • Follows reverse playlist/album order • Respects shuffle mode for random navigation • Updates position in listening history

⚠️ REQUIREMENTS: • Valid Spotify access token with user-modify-playback-state scope • Active playback session currently running • Previous track must exist in queue or history

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
deviceIdNoSpotify device ID (optional, uses active device if not specified)

Implementation Reference

  • Core handler function in SpotifyService that performs the POST request to Spotify API endpoint /me/player/previous to skip to previous track.
    async skipToPrevious(
      token: string,
      deviceId: string | null = null
    ): Promise<void> {
      const endpoint = deviceId
        ? `me/player/previous?device_id=${deviceId}`
        : "me/player/previous";
      return await this.makeRequest<void>(endpoint, token, {}, "POST");
    }
  • Tool definition and registration in playbackTools object, including title, description, schema, and wrapper handler that delegates to SpotifyService.skipToPrevious.
      skip_to_previous: {
        title: "Skip to Previous Track",
        description: `Skip to the previous track or restart the current track from the beginning.
    
    🎯 USE CASES:
    • Go back to replay favorite parts of songs
    • Navigate backwards through playlists or albums
    • Correct accidental skips to next track
    • Replay tracks that were particularly enjoyable
    • Build comprehensive playback control systems
    
    📝 WHAT IT RETURNS:
    • Information about the track that started playing
    • Playback position reset to beginning of track
    • Updated queue and playback state information
    • Confirmation of successful skip operation
    • Device status with new playback details
    
    🔍 EXAMPLES:
    • "Go back to the previous song"
    • "Play that last track again"
    • "Skip back to the song before this one"
    • "I want to hear that again"
    
    🎵 SKIP BEHAVIOR:
    • Restarts current track if more than 3 seconds have played
    • Goes to actual previous track if within first 3 seconds
    • Follows reverse playlist/album order
    • Respects shuffle mode for random navigation
    • Updates position in listening history
    
    ⚠️ REQUIREMENTS:
    • Valid Spotify access token with user-modify-playback-state scope
    • Active playback session currently running
    • Previous track must exist in queue or history`,
        schema: createSchema({
          token: commonSchemas.token(),
          deviceId: commonSchemas.deviceId(),
        }),
        handler: async (args: any, spotifyService: SpotifyService) => {
          const { token, deviceId } = args;
          return await spotifyService.skipToPrevious(token, deviceId);
        },
      },
  • Input schema definition for the skip_to_previous tool, requiring Spotify token and optional device ID.
    schema: createSchema({
      token: commonSchemas.token(),
      deviceId: commonSchemas.deviceId(),
    }),
  • Aggregates playbackTools (including skip_to_previous) into the central allTools registry used by ToolRegistrar for MCP tool registration.
    ...playbackTools,
  • Common schema helper for deviceId used in the tool's input schema.
    deviceId: () =>
      z
        .string()
        .describe(
          "Spotify device ID (optional, uses active device if not specified)"
        )
        .optional(),
  • Common schema helper for token used in the tool's input schema.
    token: () => z.string().describe("Spotify access token for authentication"),
Behavior5/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 and excels at it. The 'SKIP BEHAVIOR' section details specific rules (e.g., 'Restarts current track if more than 3 seconds have played', 'Goes to actual previous track if within first 3 seconds'), and the 'WHAT IT RETURNS' section explains output behavior, providing rich operational context beyond basic functionality.

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

Conciseness4/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, EXAMPLES, SKIP BEHAVIOR, REQUIREMENTS) that make information easy to find. While comprehensive, some sections like EXAMPLES could be more concise, but overall the structure enhances readability without excessive verbosity.

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 tool with no annotations and no output schema, the description provides exceptional completeness. It covers purpose, usage scenarios, behavioral rules, return information, examples, and requirements. The 'WHAT IT RETURNS' section effectively substitutes for an output schema by detailing what information the agent can expect back.

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%, providing complete parameter documentation. The description doesn't add any additional parameter semantics beyond what's already in the schema (token for authentication, deviceId optional). This meets the baseline expectation when schema coverage is comprehensive.

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 specific verbs ('skip to the previous track' and 'restart the current track from the beginning'), distinguishing it from sibling tools like 'skip_to_next' and 'pause_player'. It precisely defines what the tool does in different scenarios.

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 'USE CASES' section provides explicit guidance on when to use this tool (e.g., 'Go back to replay favorite parts of songs', 'Correct accidental skips to next track'), and the 'REQUIREMENTS' section clearly states prerequisites like 'Active playback session currently running' and 'Previous track must exist in queue or history', offering comprehensive usage 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/latiftplgu/Spotify-OAuth-MCP-server'

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