Skip to main content
Glama
leehave
by leehave

create_playlist

Create custom music playlists by specifying a name and optional description to organize your favorite tracks within the Claude Music MCP server.

Instructions

创建新的播放列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes播放列表名称
descriptionNo播放列表描述

Implementation Reference

  • The primary handler function for the 'create_playlist' tool. It destructures the input arguments, delegates playlist creation to PlaylistManager, and formats a success response with the new playlist details.
    private async handleCreatePlaylist(args: any) { const { name, description } = args; const playlist = await this.playlistManager.createPlaylist(name, description); return { content: [ { type: 'text', text: `✅ 播放列表创建成功!\n\n名称: ${playlist.name}\n描述: ${playlist.description || '无'}\nID: ${playlist.id}\n创建时间: ${playlist.createdAt}`, }, ], }; }
  • Input schema definition for the 'create_playlist' tool, specifying required 'name' (string) and optional 'description' (string).
    inputSchema: { type: 'object', properties: { name: { type: 'string', description: '播放列表名称', }, description: { type: 'string', description: '播放列表描述', }, }, required: ['name'], },
  • src/index.ts:79-96 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema for 'create_playlist'.
    { name: 'create_playlist', description: '创建新的播放列表', inputSchema: { type: 'object', properties: { name: { type: 'string', description: '播放列表名称', }, description: { type: 'string', description: '播放列表描述', }, }, required: ['name'], }, },
  • src/index.ts:173-174 (registration)
    Dispatch registration in the CallToolRequest handler switch statement, routing 'create_playlist' calls to the handler method.
    case 'create_playlist': return await this.handleCreatePlaylist(args);
  • Supporting helper method in PlaylistManager that generates a unique ID, creates a new Playlist instance, stores it in memory, and returns it.
    async createPlaylist(name: string, description?: string): Promise<Playlist> { const id = this.nextId.toString(); this.nextId++; const playlist: Playlist = { id, name, description, songIds: [], createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), }; this.playlists.set(id, playlist); return playlist; }

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/leehave/Claude-Music-Mcp'

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