Skip to main content
Glama
TaylorChen

Multi-MCPs

by TaylorChen

search_tracks

Find music tracks on Spotify by entering search terms. This tool helps users discover songs, artists, or albums through the Multi-MCPs server's integrated services.

Instructions

Search tracks on Spotify

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Implementation Reference

  • The handler function for the 'search_tracks' MCP tool. It validates the input arguments, checks configuration, and calls the SpotifyClient's searchTracks method to perform the search.
    async search_tracks(args: Record<string, unknown>) {
      if (!cfg.spotifyClientId || !cfg.spotifyClientSecret) throw new Error("SPOTIFY_CLIENT_ID/SECRET are not configured");
      const query = String(args.query || "");
      if (!query) throw new Error("query is required");
      const limit = args.limit ? Number(args.limit) : undefined;
      return client.searchTracks(query, limit);
    },
  • Registration of the 'search_tracks' tool in the tools array of the ToolRegistration object returned by registerSpotify().
    {
      name: "search_tracks",
      description: "Search tracks on Spotify",
      inputSchema: {
        type: "object",
        properties: { query: { type: "string" }, limit: { type: "number" } },
        required: ["query"],
      },
    },
  • Input schema defining the expected parameters for the 'search_tracks' tool: query (required string) and optional limit (number).
    inputSchema: {
      type: "object",
      properties: { query: { type: "string" }, limit: { type: "number" } },
      required: ["query"],
  • Helper method on SpotifyClient class that makes the actual Spotify API request to search for tracks.
    async searchTracks(query: string, limit?: number) {
      return this.request("/search", {
        headers: await this.authHeaders(),
        query: { q: query, type: "track", limit: limit ?? 10 },
      });
    }

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/TaylorChen/muti-mcps'

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