Skip to content

[Code Quality] Consolidate 4 duplicated MCP-server-stats structs in pkg/cli into a shared base #50676

Closed as not planned

Description

@github-actions

Description

The "per-MCP-server stats/health" concept has been independently modeled four separate times in pkg/cli, creating real drift risk as new fields get added to only some of them.

Suggested Changes

  • Introduce a shared MCPServerStatsBase{ServerName string; RequestCount, ToolCallCount, ErrorCount int}, mirroring the existing AnalysisBase/AggregatedSummaryBase dedup pattern already used in this package.
  • Have each report-specific struct embed the base, keeping only its own extra fields.

Files Affected

  • pkg/cli/audit_report.go:213 — MCPServerStats
  • pkg/cli/audit_expanded.go:90 — MCPServerHealthDetail
  • pkg/cli/audit_cross_run.go:81 — MCPServerCrossRunHealth
  • pkg/cli/gateway_logs_types.go:85 — GatewayServerMetrics

Success Criteria

  • Single canonical base struct embedded by all four report structs
  • No behavior change in generated reports
  • All existing tests pass

Source

Extracted from Typist: Go Type Consistency Analysis discussion #50544

Priority

Medium - improves maintainability; estimated 3-4 hours

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 44.7 AIC · ⌖ 3.06 AIC · ⊞ 10.3K · ◷

  • expires on Aug 6, 2026, 11:12 AM UTC-08:00

Activity

  1. github-actions commented on Aug 6, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-08-06T19:12:43.126Z.

    Closed by Workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions