create_playlist
Create a new playlist for a user by specifying their user ID and playlist name. This tool enables playlist management through the Multi-MCPs server.
Instructions
Create a new playlist for a user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | ||
| name | Yes |
Implementation Reference
- src/apis/spotify/spotify.ts:131-137 (handler)The MCP tool handler for 'create_playlist'. Validates input arguments (user_id and name) and calls the SpotifyClient's createPlaylist method to create the playlist.async create_playlist(args: Record<string, unknown>) { if (!cfg.spotifyClientId || !cfg.spotifyClientSecret) throw new Error("SPOTIFY_CLIENT_ID/SECRET are not configured"); const userId = String(args.user_id || ""); const name = String(args.name || ""); if (!userId || !name) throw new Error("user_id and name are required"); return client.createPlaylist(userId, name); },
- src/apis/spotify/spotify.ts:98-106 (registration)Registration of the 'create_playlist' tool in the Spotify API module, defining its name, description, and input schema.{ name: "create_playlist", description: "Create a new playlist for a user", inputSchema: { type: "object", properties: { user_id: { type: "string" }, name: { type: "string" } }, required: ["user_id", "name"], }, },
- src/apis/spotify/spotify.ts:101-105 (schema)Input schema definition for the 'create_playlist' tool, specifying user_id and name as required string parameters.inputSchema: { type: "object", properties: { user_id: { type: "string" }, name: { type: "string" } }, required: ["user_id", "name"], },
- src/apis/spotify/spotify.ts:57-63 (helper)Helper method in SpotifyClient class that makes the API call to create a playlist for the given user.async createPlaylist(userId: string, name: string) { return this.request(`/users/${userId}/playlists`, { method: "POST", headers: await this.authHeaders(), body: { name, public: false }, }); }