You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
get_channel_overview returns only first day's data instead of summing across date range #8
The get_channel_overview tool returns incorrect metrics when querying multi-day date ranges. It only returns data from the first day (possibly 0 if that day has no activity) instead of aggregating across all days in the range.
Root Cause
In src/utils/formatters/health.ts, the parseChannelOverview function uses data.rows[0] (first row only) instead of summing all rows:
const totalRow = data.rows[0] || []; // Bug: only uses first row
Since getChannelOverview queries with dimensions: 'day', YouTube returns one row per day. The current code discards all but the first day's data.
Reproduction
Query get_channel_overview for a date range where the first day has no activity but later days do:
Expected: Aggregated metrics across all days (e.g., 9 views)
Actual: First day's metrics only (0 views)
Contrast with Working Implementation
get_engagement_metrics works correctly because it uses calculateMetricTotals in src/utils/transformers/analytics.ts, which properly sums all rows.
Proposed Fix
Sum additive metrics (views, estimatedMinutesWatched, subscribersGained) across all rows, and use view-weighted averaging for rate metrics (averageViewDuration, averageViewPercentage).
Activity
Fix get_channel_overview to aggregate all days instead of first day only