Skip to main content
Glama

create-playlist

Generate a personalized Spotify playlist by specifying a name, optional description, and public or private visibility. Save and organize your favorite tracks with ease.

Instructions

Create a new playlist for the current user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoDescription of the playlist (optional)
nameYesName of the playlist
publicNoWhether the playlist should be public (default: false)

Implementation Reference

  • Handler for the 'create-playlist' tool: parses arguments using CreatePlaylistSchema, fetches user ID, creates a new playlist via Spotify API POST request to /users/{userId}/playlists, and returns the playlist details.
    if (name === "create-playlist") { const { name, description, public: isPublic } = CreatePlaylistSchema.parse(args); const userInfo = await spotifyApiRequest("/me"); const userId = userInfo.id; const playlist = await spotifyApiRequest( `/users/${userId}/playlists`, "POST", { name, description, public: isPublic, } ); return { content: [ { type: "text", text: `Playlist created successfully: Name: ${playlist.name} ID: ${playlist.id} URL: ${playlist.external_urls.spotify}`, }, ], }; }
  • Zod schema for validating input parameters of the create-playlist tool: requires 'name', optional 'description' and 'public' (defaults to false). Used in both registration inputSchema and handler parsing.
    const CreatePlaylistSchema = z.object({ name: z.string(), description: z.string().optional(), public: z.boolean().default(false), });
  • index.ts:729-750 (registration)
    Tool registration in the ListTools response: defines name, description, and inputSchema matching the CreatePlaylistSchema.
    { name: "create-playlist", description: "Create a new playlist for the current user", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the playlist", }, description: { type: "string", description: "Description of the playlist (optional)", }, public: { type: "boolean", description: "Whether the playlist should be public (default: false)", }, }, required: ["name"], }, },

Other Tools

Related Tools

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/imprvhub/mcp-claude-spotify'

If you have feedback or need assistance with the MCP directory API, please join our Discord server