Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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)

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/lodordev/mcp-tautulli'

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