Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameYes
user_idYes

Implementation Reference

  • 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); },
  • 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"], },
  • 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"], }, },
  • 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 }, }); }
  • Invocation of registerSpotify() within registerAllTools() to include Spotify tools (including create_playlist) in the MCP server.
    registerTrello(), registerSpotify(),

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