Skip to main content
Glama

tautulli_user_stats

Retrieve user watch statistics from Tautulli, including total plays, watch time, and last seen activity within a specified time range.

Instructions

Get per-user watch statistics — total plays, watch time, last seen.

Args: user: Filter to a specific username. If empty, shows all active users. days: Time range in days for stats (default 30).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userNo
daysNo

Implementation Reference

  • The tautulli_user_stats function is a tool that retrieves per-user watch statistics, including total plays, duration, and last seen activity from Tautulli. It uses the _api helper to fetch data.
    @mcp.tool()
    async def tautulli_user_stats(user: str = "", days: int = 30) -> str:
        """Get per-user watch statistics — total plays, watch time, last seen.
    
        Args:
            user: Filter to a specific username. If empty, shows all active users.
            days: Time range in days for stats (default 30).
        """
        days = _clamp_days(days)
        params: dict = {"length": "25", "order_column": "plays", "order_dir": "desc"}
        if user:
            params["search"] = _sanitize_str(user)
    
        data = await _api("get_users_table", **params)
        users = data.get("data", [])
    
        if not users:
            return "No users found."
    
        lines = ["User statistics:\n"]
        for u in users:
            name = u.get("friendly_name") or u.get("username", "?")
            plays = u.get("plays", 0)
            duration = _fmt_duration(u.get("duration", 0))
            last_played = u.get("last_played", "")
            last_seen = u.get("last_seen")
    
            if plays == 0:
                continue  # Skip inactive users
    
            parts = [f"  • {name}: {plays} plays, {duration} watched"]
            if last_played:
                parts.append(f"last: \"{last_played}\"")
    
            lines.append(" — ".join(parts))
    
        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