search_tracks
Search and retrieve Spotify tracks by entering a query and optional limit. Part of the Multi-MCPs server, which integrates multiple APIs for unified access to web services.
Instructions
Search tracks on Spotify
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| query | Yes |
Implementation Reference
- src/apis/spotify/spotify.ts:118-124 (handler)The handler function that implements the core logic for the 'search_tracks' tool. It validates the Spotify configuration, extracts and validates the query and optional limit parameters, and calls the SpotifyClient's searchTracks method.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); },
- src/apis/spotify/spotify.ts:83-87 (schema)Input schema for the 'search_tracks' tool, defining an object with required 'query' (string) and optional 'limit' (number).inputSchema: { type: "object", properties: { query: { type: "string" }, limit: { type: "number" } }, required: ["query"], },
- src/apis/spotify/spotify.ts:80-88 (registration)Registration of the 'search_tracks' tool in the tools array of the Spotify ToolRegistration, including name, description, and input schema.{ name: "search_tracks", description: "Search tracks on Spotify", inputSchema: { type: "object", properties: { query: { type: "string" }, limit: { type: "number" } }, required: ["query"], }, },
- src/apis/spotify/spotify.ts:46-51 (helper)Helper method in SpotifyClient class that performs the actual API request to Spotify's search endpoint for tracks.async searchTracks(query: string, limit?: number) { return this.request("/search", { headers: await this.authHeaders(), query: { q: query, type: "track", limit: limit ?? 10 }, }); }