list_playlists
Retrieve all available playlists from the Claude Music MCP server to view and manage your music collections.
Instructions
列出所有播放列表
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_playlists"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:286-299 (handler)The handler function that implements the core logic of the 'list_playlists' tool. It fetches all playlists using PlaylistManager and formats a response listing their names, descriptions, song counts, and IDs.
private async handleListPlaylists(args: any) { const playlists = await this.playlistManager.getAllPlaylists(); return { content: [ { type: 'text', text: `📋 所有播放列表:\n\n${playlists.map(playlist => `🎵 ${playlist.name}\n📝 ${playlist.description || '无描述'}\n🎶 ${playlist.songIds.length} 首歌曲\n🆔 ID: ${playlist.id}\n` ).join('\n')}`, }, ], }; } - src/index.ts:129-136 (registration)Registration of the 'list_playlists' tool in the ListTools response, including its name, description, and empty input schema.
{ name: 'list_playlists', description: '列出所有播放列表', inputSchema: { type: 'object', properties: {}, }, }, - src/index.ts:179-180 (registration)Dispatcher case in the CallToolRequest handler that routes 'list_playlists' calls to the specific handler function.
case 'list_playlists': return await this.handleListPlaylists(args); - src/index.ts:132-135 (schema)Input schema definition for the 'list_playlists' tool, which requires no parameters.
inputSchema: { type: 'object', properties: {}, }, - src/playlist-manager.ts:35-37 (helper)Supporting method in PlaylistManager that retrieves all playlists, used by the tool handler.
async getAllPlaylists(): Promise<Playlist[]> { return Array.from(this.playlists.values()); }