Skip to main content
Glama

get_track_lyrics

Retrieve plain text lyrics for any Spotify track to display in applications, analyze for research, or create lyric-based features.

Instructions

Retrieve plain text lyrics for any Spotify track in a clean, readable format.

🎯 USE CASES: • Analyze song lyrics for music analysis, research, or content creation • Display lyrics in music applications for reading along • Create lyric-based search and discovery features • Develop music education tools with lyric analysis • Build lyrics display features for music players

📝 WHAT IT RETURNS: • Structured response with success status and error handling • Complete track information (name, artist, album, duration) • Plain text lyrics in clean, readable format • Instrumental track detection for non-vocal content • Fallback message when lyrics are unavailable

🔍 EXAMPLES: • "Show me the lyrics for 'Bohemian Rhapsody' by Queen" • "Get the lyrics for this track" • "What are the lyrics to track ID: 4uLU6hMCjMI75M1A2tKUQC?" • "Display the song lyrics for analysis"

🎵 RESPONSE FORMAT: • Success response includes track metadata and lyrics string • Plain text lyrics with line breaks for easy reading • Error responses provide helpful fallback information • Instrumental flag indicates tracks without vocals • Clean format perfect for display and analysis

💡 LYRIC FEATURES: • Clean plain text format without timestamps • Easy to read and analyze lyrics content • Error handling for unavailable or missing lyrics • UTF-8 support for international character sets • Perfect for lyrics display and text analysis

⚠️ REQUIREMENTS: • Valid Spotify access token • Track must exist and be available in user's market • Uses external lyrics service for comprehensive coverage • Returns clean plain text lyrics only

🔍 EXAMPLE RESPONSE FORMAT:

{ "success": true, "track": { "name": "Bohemian Rhapsody", "artist": "Queen", "album": "A Night at the Opera", "duration": 354 }, "lyrics": "Verse 1: Is this the real life? Is this just fantasy? Caught in a landslide, No escape from reality.

Chorus: Mama, just killed a man Put a gun against his head Pulled my trigger, now he's dead

Verse 2: Too late, my time has come Sends shivers down my spine Body's aching all the time", "instrumental": false }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
trackIdYesSpotify track ID or URI

Implementation Reference

  • The handler function that implements the core logic of the 'get_track_lyrics' tool. It retrieves track information using SpotifyService, fetches lyrics from lrclib.net API, and returns formatted lyrics or error response.
    handler: async (args: any, spotifyService: SpotifyService) => {
      const { token, trackId } = args;
    
      try {
        const track = await spotifyService.getTrack(token, trackId);
        const response = await fetch(
          `https://lrclib.net/api/get?artist_name=${encodeURIComponent(
            track.artists[0].name
          )}&track_name=${encodeURIComponent(track.name)}`
        );
    
        if (!response.ok) {
          return {
            success: false,
            message: "Lyrics not found for this track",
            track: {
              name: track.name,
              artist: track.artists[0].name,
              album: track.album?.name,
            },
          };
        }
    
        const data = await response.json();
    
        return {
          success: true,
          track: {
            name: data.trackName || track.name,
            artist: data.artistName || track.artists[0].name,
            album: data.albumName || track.album?.name,
            duration: data.duration || Math.floor(track.duration_ms / 1000),
          },
          lyrics: data.plainLyrics || "Lyrics not available for this track",
          instrumental: data.instrumental || false,
        };
      } catch (error) {
        return {
          success: false,
          message: "Error fetching lyrics",
          error: error instanceof Error ? error.message : "Unknown error",
        };
      }
    },
  • Input schema definition for the 'get_track_lyrics' tool, validating token and trackId parameters using Zod.
    schema: createSchema({
      token: commonSchemas.token(),
      trackId: commonSchemas.spotifyId("track"),
    }),
  • Registration of all tools including trackTools (which contains 'get_track_lyrics') into the central allTools registry used by the MCP server.
    export const allTools: ToolsRegistry = {
      ...albumTools,
    
      ...artistTools,
    
      ...trackTools,
    
      ...playlistTools,
    
      ...playbackTools,
    
      ...userTools,
    
      ...searchTools,
    };
  • The 'get_track_lyrics' tool is registered as a property in the trackTools export object.
    get_track_lyrics: {
  • SpotifyService.getTrack helper method called by the tool handler to fetch track metadata before retrieving lyrics.
    async getTrack(token: string, trackId: string): Promise<SpotifyTrack> {
      const id = this.extractId(trackId);
      return await this.makeRequest<SpotifyTrack>(`tracks/${id}`, token);
    }
Behavior4/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 effectively describes key traits: it's a read-only retrieval tool (implied by 'Retrieve'), mentions external service usage, error handling, instrumental detection, and market availability constraints. It lacks details on rate limits or caching behavior, but covers most essential aspects well.

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

Conciseness2/5

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

The description is excessively long and repetitive, with multiple sections (USE CASES, WHAT IT RETURNS, EXAMPLES, RESPONSE FORMAT, LYRIC FEATURES, REQUIREMENTS, EXAMPLE RESPONSE FORMAT) that overlap in content. For instance, 'Clean plain text format' is mentioned multiple times. It is not front-loaded; key information is buried in lengthy lists, reducing efficiency for an AI agent.

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

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is quite complete. It covers purpose, usage, behavioral traits, response format with examples, and requirements. However, the lack of an output schema means the description must fully explain returns, which it does adequately but with redundancy, slightly lowering the score.

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?

The input schema has 100% description coverage, clearly documenting both parameters (token for authentication, trackId for identification). The description does not add any meaningful parameter-specific information beyond what the schema provides, such as format examples for trackId or token validation details, so it meets the baseline but doesn't enhance understanding.

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 verb ('Retrieve') and resource ('plain text lyrics for any Spotify track'), distinguishing it from siblings like 'get_track' (which likely returns track metadata without lyrics) and 'search_tracks' (which searches for tracks). The opening sentence is direct and unambiguous.

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 'USE CASES' section provides clear context for when to use this tool (e.g., for lyrics analysis, display, or education), and the 'REQUIREMENTS' section lists prerequisites like a valid Spotify token. However, it does not explicitly state when NOT to use it or name alternatives (e.g., using 'get_track' for metadata without lyrics), which prevents a perfect score.

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