Skip to main content
Glama

search_music

Search for tracks, albums, and artists on Spotify to find music using queries and control playback through MCP tools.

Instructions

Search for music (tracks, albums, artists) on Spotify

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
limitNoMaximum number of results per type (default: 10)

Implementation Reference

  • The core handler function that executes the search_music tool logic, delegating to SpotifyClient.search and formatting the results.
    export async function searchMusic(client: SpotifyClient, query: string, limit: number = 10) { const results = await client.search(query, limit); return { success: true, query, results: { tracks: results.tracks.slice(0, limit), albums: results.albums.slice(0, limit), artists: results.artists.slice(0, limit), }, }; }
  • Input schema definition for the search_music tool in the ListTools response.
    inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query', }, limit: { type: 'number', description: 'Maximum number of results per type (default: 10)', }, }, required: ['query'], },
  • src/server.ts:269-282 (registration)
    Registration of the search_music handler in the MCP server's CallToolRequestHandler switch statement.
    case 'search_music': const searchResult = await searchTools.searchMusic( client, args?.query as string, (args?.limit as number) || 10 ); return { content: [ { type: 'text', text: JSON.stringify(searchResult, null, 2), }, ], };

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/Ackberry/spotify_mcp'

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