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); }

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