Skip to content

Add repository traffic/insights tools (views, clones, referrers, paths) - #3246

Open
musch711 wants to merge 7 commits into
github:mainfrom
musch711:add-repo-traffic-tools
Open

Add repository traffic/insights tools (views, clones, referrers, paths)#3246
musch711 wants to merge 7 commits into
github:mainfrom
musch711:add-repo-traffic-tools

Conversation

@musch711

@musch711 musch711 commented Sep 8, 2026

Copy link
Copy Markdown

Closes #3164.

Adds four read-only tools under the repos toolset that wrap GitHub's repository traffic endpoints:

Tool Endpoint
get_traffic_views GET /repos/{owner}/{repo}/traffic/views
get_traffic_clones GET /repos/{owner}/{repo}/traffic/clones
get_traffic_referrers GET /repos/{owner}/{repo}/traffic/popular/referrers
get_traffic_paths GET /repos/{owner}/{repo}/traffic/popular/paths

Why

Agents can already read stars and forks but have no view into whether a repo is actually being visited or cloned, which is the primary signal for adoption and reach. Because GitHub only retains traffic data for a rolling 14-day window, an agent that snapshots it on a schedule is the natural use case for longer-term trend tracking.

Implementation notes

  • All four are ReadOnlyHint: true under the existing repos toolset.
  • The pinned go-github v89 client already exposes ListTrafficViews, ListTrafficClones, ListTrafficReferrers, and ListTrafficPaths, so there is no new HTTP plumbing. views/clones take an optional per (day|week) mapping to TrafficBreakdownOptions; referrers/paths take just owner/repo.
  • These endpoints require push access (GitHub App: Administration: Read), so the tools use scopes.RequireAll(scopes.Repo) rather than public-read.
  • Traffic data is never world-readable, so results carry a new static IFC label LabelRepoTraffic() (always private, mirroring LabelCollaboratorRoster).
  • Added tests (success + no-push-access 403) for each tool, regenerated tool snapshots, and regenerated docs.

@musch711
musch711 requested a review from a team as a code owner September 8, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add repository traffic/insights tools (views, clones, referrers, paths)

3 participants