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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | 播放列表名称 | |
| description | No | 播放列表描述 |
Implementation Reference
- src/index.ts:233-245 (handler)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}`, }, ], }; }
- src/index.ts:82-95 (schema)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);
- src/playlist-manager.ts:14-29 (helper)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; }