modify_playlist
Update Spotify playlist details including name, visibility, collaboration settings, and description using the playlist ID.
Instructions
Change a playlist's name and public/private state
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The Spotify ID or URI of the playlist | |
| name | No | Optional. New name for the playlist | |
| public | No | Optional. If true the playlist will be public | |
| collaborative | No | Optional. If true, the playlist will become collaborative | |
| description | No | Optional. New description for the playlist |
Implementation Reference
- src/handlers/playlists.ts:54-70 (handler)The core handler function that modifies a playlist's name, public status, collaborative status, or description by sending a PUT request to the Spotify API /playlists/{id} endpoint.async modifyPlaylist(args: ModifyPlaylistArgs) { const playlistId = this.extractPlaylistId(args.id); const { name, public: isPublic, collaborative, description } = args; const data = { ...(name !== undefined && { name }), ...(isPublic !== undefined && { public: isPublic }), ...(collaborative !== undefined && { collaborative }), ...(description !== undefined && { description }) }; return this.api.makeRequest( `/playlists/${playlistId}`, 'PUT', data ); }
- src/types/playlists.ts:17-23 (schema)TypeScript interface defining the input arguments for the modify_playlist tool, including required playlist ID and optional fields for modification.export interface ModifyPlaylistArgs { id: string; name?: string; public?: boolean; collaborative?: boolean; description?: string; }
- src/index.ts:527-556 (registration)MCP tool registration in the ListTools response, defining the name, description, and input schema for the modify_playlist tool.{ name: 'modify_playlist', description: 'Change a playlist\'s name and public/private state', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'The Spotify ID or URI of the playlist' }, name: { type: 'string', description: 'Optional. New name for the playlist' }, public: { type: 'boolean', description: 'Optional. If true the playlist will be public' }, collaborative: { type: 'boolean', description: 'Optional. If true, the playlist will become collaborative' }, description: { type: 'string', description: 'Optional. New description for the playlist' } }, required: ['id'] }, },
- src/index.ts:853-859 (registration)Dispatch handler in the CallToolRequest that validates arguments and calls the playlistsHandler.modifyPlaylist method.case 'modify_playlist': { const args = this.validateArgs<ModifyPlaylistArgs>(request.params.arguments, ['id']); const result = await this.playlistsHandler.modifyPlaylist(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }