The Pirate Phase 1.b extension: Plex tools

Adds 4 read-only Plex tools using a new plex_get helper that sends
X-Plex-Token as a query param and Accept: application/json:
- plex_library_sections: per-section item counts
- plex_on_deck: in-progress items across all libraries
- plex_watch_history: recent watches with user-name resolution via /accounts
- plex_recently_added: latest additions across sections

Token sourced from Plex registry on Darrow (HKU per-user hive). Stored
in service_configs.plex. Plex paginated counts require BOTH
X-Plex-Container-Start and X-Plex-Container-Size in query string to
return totalSize — dropping Start makes Plex return the full library.

Pirate catalog: 20 → 24 tools.
This commit is contained in:
Eric Jungbauer
2026-04-20 23:02:44 +00:00
parent 20a8987dd9
commit 607168815b
3 changed files with 170 additions and 2 deletions
+2 -2
View File
@@ -7,13 +7,13 @@ The runtime loads all modules here and builds a combined catalog. The LLM picks
which tool to call; the runtime executes it and returns the result as a tool message.
"""
from . import sonarr, radarr, lidarr, whisparr, qbittorrent, storage, overseerr
from . import sonarr, radarr, lidarr, whisparr, qbittorrent, storage, overseerr, plex
def build_catalog():
"""Return a list of all available tools across all modules."""
catalog = []
for mod in (sonarr, radarr, lidarr, whisparr, qbittorrent, storage, overseerr):
for mod in (sonarr, radarr, lidarr, whisparr, qbittorrent, storage, overseerr, plex):
catalog.extend(getattr(mod, "TOOLS", []))
return catalog