Skip to main content
Glama
TaylorChen

Multi-MCPs

by TaylorChen

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

Implementation Reference

  • 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);
    },
  • 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"],
      },
    },
  • 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"],
    },
  • 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 },
      });
    }

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