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);
    }
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 what the tool does (search with filtering and ranking), what it returns (multi-type results with metadata), and requirements (access token, query length). It includes advanced features like typo correction and market filtering, but lacks details on rate limits, error handling, or pagination, leaving some behavioral gaps.

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

Conciseness3/5

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

The description is well-structured with sections (e.g., USE CASES, WHAT IT RETURNS), but it is overly verbose with redundant details (e.g., extensive examples and strategies that could be condensed). While informative, some sentences like 'Real-time search result updates' don't earn their place for core tool understanding, reducing efficiency.

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 4 parameters, 50% schema coverage, no annotations, and no output schema, the description does a good job covering purpose, usage, and behavioral aspects. It explains returns and requirements thoroughly, but lacks output format details (e.g., structure of results) and error scenarios, making it slightly incomplete for full agent invocation.

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?

Schema description coverage is 50% (only 'token' and 'query' have descriptions). The description compensates by explaining 'type' through the 'SEARCH TYPES' section and implying 'limit' via examples like 'limit' in context, though not explicitly. It adds meaning beyond the schema by detailing search strategies and use cases, but doesn't fully document all parameters, resulting in a slight gap.

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 performs 'comprehensive music search across all Spotify content types with intelligent filtering and ranking,' specifying the verb (search), resource (music/Spotify content), and scope (all content types). It distinguishes from siblings like search_tracks, search_albums, etc., by emphasizing its multi-type capability, making the purpose specific and differentiated.

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 description provides explicit usage guidance through sections like 'USE CASES,' 'EXAMPLES,' and 'SEARCH STRATEGIES,' detailing when to use it (e.g., for universal discovery, partial information searches, or dynamic recommendations). It implicitly distinguishes from sibling tools by covering multiple content types, though it doesn't explicitly name alternatives; the comprehensive examples and strategies make the context clear.

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