Skip to main content
Glama

search_music

Search Spotify's music catalog to find tracks, albums, artists, and playlists using keywords, genres, or partial information for music discovery and retrieval.

Instructions

Perform comprehensive music search across all Spotify content types with intelligent filtering and ranking.

🎯 USE CASES: β€’ Universal music discovery across tracks, albums, artists, and playlists β€’ Build intelligent search interfaces for music applications β€’ Find specific songs when you only remember partial information β€’ Discover new music based on keywords, moods, or themes β€’ Create dynamic search-based music recommendations

πŸ“ WHAT IT RETURNS: β€’ Multi-type search results (tracks, artists, albums, playlists) β€’ Relevance-ranked results based on Spotify's search algorithms β€’ Complete metadata for each result type β€’ Popularity scores and user engagement metrics β€’ Links to explore each result in detail

πŸ” EXAMPLES: β€’ "Search for 'upbeat dance music' in tracks" β€’ "Find 'acoustic guitar' content across all types" β€’ "Look for 'Beatles' in artists and albums" β€’ "Search for '90s hip hop' in playlists"

🎡 SEARCH TYPES: β€’ 'track' - Individual songs and recordings β€’ 'album' - Full album releases and EPs β€’ 'artist' - Musicians, bands, and performers β€’ 'playlist' - User and editorial playlists β€’ 'show' - Podcasts and audio shows β€’ 'episode' - Individual podcast episodes

πŸ’‘ SEARCH STRATEGIES: β€’ Use descriptive keywords: "chill indie folk" β€’ Include artist names: "Taylor Swift love songs" β€’ Try genre combinations: "electronic jazz fusion" β€’ Use mood descriptors: "energetic workout beats" β€’ Include decades: "80s synthwave nostalgia"

πŸ” ADVANCED FEATURES: β€’ Intelligent typo correction and suggestions β€’ Context-aware search ranking β€’ Market-specific availability filtering β€’ Real-time search result updates β€’ Multi-language search support

⚠️ REQUIREMENTS: β€’ Valid Spotify access token β€’ Search queries should be at least 2 characters long

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
queryYesSearch query for music content (keyword, title, artist)
typeNotrack
limitNo

Implementation Reference

  • The handler function that executes the core logic of the 'search_music' tool by calling the Spotify service.
    handler: async (args: any, spotifyService: SpotifyService) => { const { token, query, type = "track", limit = 10 } = args; return await spotifyService.searchMusic(token, query, type, limit); },
  • The input schema defining parameters for the 'search_music' tool: token, query, type, limit.
    schema: createSchema({ token: commonSchemas.token(), query: commonSchemas.searchQuery( "music content (keyword, title, artist)" ), type: commonSchemas.searchType(), limit: commonSchemas.limit(1, 50, 10), }),
  • Registration of searchTools (including 'search_music') into the central allTools registry used by the MCP ToolRegistrar.
    export const allTools: ToolsRegistry = { ...albumTools, ...artistTools, ...trackTools, ...playlistTools, ...playbackTools, ...userTools, ...searchTools, };
  • The SpotifyService.searchMusic helper method that performs the actual Spotify API search call.
    async searchMusic( token: string, query: string, type: "track" | "album" | "artist" | "playlist" = "track", limit: number = 10 ): Promise<SearchResult> { const params = { q: query, type: type, limit: Math.min(limit, 50), }; return await this.makeRequest<SearchResult>("search", token, params); }

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