Skip to main content
Glama

delete_playlist

Remove a playlist from your Plex Media Server by specifying its unique playlist key. Ensures efficient playlist management through direct integration with Plex API.

Instructions

Delete a playlist from the Plex server.

Parameters: playlist_key: The key of the playlist to delete.

Returns: A success message if deletion is successful, or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlist_keyYes

Implementation Reference

  • The core handler function for the 'delete_playlist' tool, decorated with @mcp.tool() for registration in the MCP framework. It handles connecting to the Plex server, locating the playlist by key, deleting it, and returning appropriate success or error messages.
    async def delete_playlist(playlist_key: str) -> str: """ Delete a playlist from the Plex server. Parameters: playlist_key: The key of the playlist to delete. Returns: A success message if deletion is successful, or an error message. """ try: plex = await get_plex_server() except Exception as e: return f"ERROR: Could not connect to Plex server. {str(e)}" try: key = int(playlist_key) all_playlists = await asyncio.to_thread(plex.playlists) playlist = next((p for p in all_playlists if p.ratingKey == key), None) if not playlist: return f"No playlist found with key {playlist_key}." await asyncio.to_thread(playlist.delete) logger.info("Playlist '%s' with key %s successfully deleted.", playlist.title, playlist_key) return f"Successfully deleted playlist '{playlist.title}' with key {playlist_key}." except NotFound: return f"ERROR: Playlist with key {playlist_key} not found." except Exception as e: logger.exception("Failed to delete playlist with key '%s'", playlist_key) return f"ERROR: Failed to delete playlist. {str(e)}"
  • The delete_playlist function is imported and exposed via __all__ in the package __init__.py, making it available for use and potentially for tool registration in the broader application.
    delete_playlist, add_to_playlist, recent_movies, get_movie_genres, get_plex_server, MovieSearchParams, ) __all__ = [ "search_movies", "get_movie_details", "list_playlists", "get_playlist_items", "create_playlist", "delete_playlist",
  • Explicit listing in __all__ confirms public exposure of the delete_playlist tool.
    "delete_playlist", "add_to_playlist", "recent_movies", "get_movie_genres", "get_plex_server", "MovieSearchParams", ]

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/djbriane/plex-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server