Skip to main content
Glama
leehave
by leehave

create_playlist

Build personalized music playlists by specifying a name and optional description. Streamline music organization and enhance listening experiences with this playlist creation tool.

Instructions

创建新的播放列表

Input Schema

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

Implementation Reference

  • The MCP tool handler for 'create_playlist' that destructures input arguments, invokes PlaylistManager.createPlaylist, and returns a formatted success response containing 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' and optional 'description' parameters.
    inputSchema: { type: 'object', properties: { name: { type: 'string', description: '播放列表名称', }, description: { type: 'string', description: '播放列表描述', }, }, required: ['name'],
  • src/index.ts:79-96 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the 'create_playlist' tool's name, description, and input schema.
    { name: 'create_playlist', description: '创建新的播放列表', inputSchema: { type: 'object', properties: { name: { type: 'string', description: '播放列表名称', }, description: { type: 'string', description: '播放列表描述', }, }, required: ['name'], }, },
  • Core logic for creating a new playlist in the PlaylistManager class, generating ID, initializing empty song list, and storing in memory.
    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; }
  • TypeScript interface defining the structure of a Playlist object, used as return type for createPlaylist.
    export interface Playlist { id: string; name: string; description?: string; songIds: string[]; createdAt: string; updatedAt: string; }

Other Tools

Related Tools

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