plex_library
Manage Plex media libraries with operations for listing, creating, updating, scanning, and cleaning. Handle library locations, refresh metadata, empty trash, and list items with filters.
Instructions
Comprehensive library management operations for Plex Media Server.
PORTMANTEAU PATTERN RATIONALE: Consolidates 12+ library-related operations into a single tool to prevent tool explosion. Simplifies library lifecycle management (CRUD, scan, optimize) for agents.
OPERATIONS:
list: List all media libraries.
get: Get detailed information about a specific library.
create/update/delete: Manage library existence and settings.
scan/refresh: Update media index and metadata.
optimize/empty_trash/clean_bundles: Maintain library database health.
add_location/remove_location: Manage physical media paths.
list_items: List paginated library contents with sort and type filters.
Return Format
{"success": bool, "data": dict|list, "operation": str, "count": int}
Examples
await plex_library(operation="list") await plex_library(operation="get", library_id="1") await plex_library(operation="scan", library_id="1", force=True) await plex_library(operation="list_items", library_id="1", sort="title", media_type="movie")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Name for the new or updated library. | |
| path | No | Filesystem path to add or remove as a library location. | |
| sort | No | Sort field for list_items (title, rating, year, added). | |
| agent | No | Plex metadata agent identifier (e.g. com.plexapp.agents.imdb). | |
| force | No | Force operations like scan even if already up to date. | |
| limit | No | Max items to return for list_items. | |
| thumb | No | URL or path for the library thumbnail. | |
| offset | No | Pagination offset for list_items. | |
| scanner | No | Plex scanner identifier (e.g. Plex Movie Scanner). | |
| language | No | Language code for the library metadata. | |
| operation | Yes | The library operation to perform. | |
| library_id | No | ID of the target library section. | |
| media_type | No | Filter by media type for list_items (movie, show, episode, track, photo). | |
| library_type | No | Type of media library to create. |