get_song_info
Retrieve detailed information about a specific song using its unique song ID within the Claude Music MCP server. Supports music management by accessing song metadata for seamless playlist creation and recommendations.
Instructions
获取歌曲详细信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| songId | Yes | 歌曲ID |
Implementation Reference
- src/index.ts:215-231 (handler)The primary handler function for the 'get_song_info' tool. Extracts songId, fetches song from database, formats and returns details or errors if not found.private async handleGetSongInfo(args: any) { const { songId } = args; const song = await this.musicDb.getSongById(songId); if (!song) { throw new Error(`未找到ID为 ${songId} 的歌曲`); } return { content: [ { type: 'text', text: `🎵 歌曲信息:\n\n标题: ${song.title}\n艺术家: ${song.artist}\n专辑: ${song.album}\n发行年份: ${song.year}\n时长: ${song.duration}\n风格: ${song.genre}\n播放次数: ${song.playCount}\n评分: ${song.rating}/5`, }, ], }; }
- src/index.ts:66-78 (registration)Registration of the 'get_song_info' tool in ListTools handler, defining name, description, and input schema.name: 'get_song_info', description: '获取歌曲详细信息', inputSchema: { type: 'object', properties: { songId: { type: 'string', description: '歌曲ID', }, }, required: ['songId'], }, },
- src/music-database.ts:96-98 (helper)Helper method in MusicDatabase class that finds and returns a song by ID from the in-memory song list, invoked by the tool handler.async getSongById(id: string): Promise<Song | undefined> { return this.songs.find(song => song.id === id); }