Skip to content

get_channel_overview returns only first day's data instead of summing across date range #8

Open

Description

@daniel-lipkin

Bug Description

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:

get_channel_overview({ startDate: "2024-01-01", endDate: "2024-12-31" })

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

  1. added a commit that references this issue on Feb 1, 2026
    5f2f5a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions