tautulli_platform_stats
Retrieve statistics on top platforms and devices by play count and total watch time from your Tautulli server.
Instructions
Get top platforms/devices by plays and total watch time.
Args: days: Time range in days (default 30).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No |
Implementation Reference
- tautulli.py:494-518 (handler)The handler function that executes the `tautulli_platform_stats` tool logic by querying the Tautulli API and formatting the response.
async def tautulli_platform_stats(days: int = 30) -> str: """Get top platforms/devices by plays and total watch time. Args: days: Time range in days (default 30). """ days = _clamp_days(days) data = await _api("get_home_stats", time_range=str(days), stat_id="top_platforms") rows = data.get("rows", []) if not rows: return f"No platform data for the last {days} days." lines = [f"Top platforms (last {days} days):\n"] for i, r in enumerate(rows[:10], 1): platform = r.get("platform", "Unknown") plays = r.get("total_plays", 0) duration = _fmt_duration(r.get("total_duration", 0)) lines.append(f" {i}. {platform} — {plays} plays, {duration} watched") total_plays = sum(r.get("total_plays", 0) for r in rows) total_dur = sum(r.get("total_duration", 0) for r in rows) lines.append(f"\nTotal: {total_plays} plays, {_fmt_duration(total_dur)} watched across {len(rows)} platforms") return "\n".join(lines)