create_playlist
Generate a personalized playlist for a specific user by specifying a user ID and playlist name. Integrated with Spotify through the Multi-MCPs server, this tool simplifies playlist creation by unifying access to multiple APIs.
Instructions
Create a new playlist for a user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| user_id | Yes |
Implementation Reference
- src/apis/spotify/spotify.ts:131-137 (handler)The handler function that implements the core logic of the create_playlist tool by validating inputs and invoking the SpotifyClient.createPlaylist method.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:101-105 (schema)The input schema defining the required user_id and name parameters for the create_playlist tool.inputSchema: { type: "object", properties: { user_id: { type: "string" }, name: { type: "string" } }, required: ["user_id", "name"], },
- src/apis/spotify/spotify.ts:98-106 (registration)The tool registration object for create_playlist, including name, description, and schema, added to the tools array in registerSpotify().{ 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:57-63 (helper)The SpotifyClient helper method that performs the actual HTTP POST request to create a playlist on Spotify API.async createPlaylist(userId: string, name: string) { return this.request(`/users/${userId}/playlists`, { method: "POST", headers: await this.authHeaders(), body: { name, public: false }, }); }
- src/tools/register.ts:28-29 (registration)Invocation of registerSpotify() within registerAllTools() to include Spotify tools (including create_playlist) in the MCP server.registerTrello(), registerSpotify(),