tautulli_library_stats
Retrieve library statistics including item counts, total plays, and last played content from your Tautulli server.
Instructions
Get library-level statistics — item counts, total plays, and last played content per library.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tautulli.py:291-323 (handler)The tautulli_library_stats tool handler, registered with @mcp.tool(), which fetches library stats from Tautulli API and formats them for display.
@mcp.tool() async def tautulli_library_stats() -> str: """Get library-level statistics — item counts, total plays, and last played content per library.""" data = await _api("get_libraries_table") libraries = data.get("data", []) if not libraries: return "No libraries found." lines = ["Library statistics:\n"] for lib in libraries: name = lib.get("section_name", "?") section_type = lib.get("section_type", "") count = lib.get("count", 0) plays = lib.get("plays", 0) last = lib.get("last_played", "") # Build count string based on type if section_type == "show": seasons = lib.get("parent_count", 0) episodes = lib.get("child_count", 0) count_str = f"{count} shows, {seasons} seasons, {episodes} episodes" elif section_type == "artist": albums = lib.get("parent_count", 0) tracks = lib.get("child_count", 0) count_str = f"{count} artists/authors, {albums} albums, {tracks} tracks" else: count_str = f"{count} items" last_str = f" — last: \"{last}\"" if last else "" lines.append(f" • {name} ({section_type}): {count_str}, {plays} plays{last_str}") return "\n".join(lines)