get_playlist
Retrieve detailed information about a specific playlist using its unique ID. Part of Claude Music MCP for managing, searching, and organizing music playlists efficiently.
Instructions
获取播放列表信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| playlistId | Yes | 播放列表ID |
Implementation Reference
- src/index.ts:262-284 (handler)Primary handler for 'get_playlist' tool: extracts playlistId, fetches playlist and songs, formats response.private async handleGetPlaylist(args: any) { const { playlistId } = args; const playlist = await this.playlistManager.getPlaylist(playlistId); if (!playlist) { throw new Error(`未找到ID为 ${playlistId} 的播放列表`); } const songs = await Promise.all( playlist.songIds.map(id => this.musicDb.getSongById(id)) ); return { content: [ { type: 'text', text: `🎵 播放列表: ${playlist.name}\n\n描述: ${playlist.description || '无'}\n歌曲数量: ${playlist.songIds.length}\n创建时间: ${playlist.createdAt}\n\n歌曲列表:\n${songs.map((song, index) => `${index + 1}. ${song?.title} - ${song?.artist}` ).join('\n')}`, }, ], }; }
- src/index.ts:116-128 (registration)Tool registration defining name, description, and input schema for 'get_playlist'.name: 'get_playlist', description: '获取播放列表信息', inputSchema: { type: 'object', properties: { playlistId: { type: 'string', description: '播放列表ID', }, }, required: ['playlistId'], }, },
- src/playlist-manager.ts:1-8 (schema)TypeScript interface defining the Playlist data structure used by the tool.export interface Playlist { id: string; name: string; description?: string; songIds: string[]; createdAt: string; updatedAt: string; }
- src/playlist-manager.ts:31-33 (helper)Core helper method in PlaylistManager that retrieves a playlist by ID from in-memory storage.async getPlaylist(id: string): Promise<Playlist | undefined> { return this.playlists.get(id); }