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 · ◷
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
MCPServerStatsBase{ServerName string; RequestCount, ToolCallCount, ErrorCount int}, mirroring the existingAnalysisBase/AggregatedSummaryBasededup pattern already used in this package.Files Affected
pkg/cli/audit_report.go:213—MCPServerStatspkg/cli/audit_expanded.go:90—MCPServerHealthDetailpkg/cli/audit_cross_run.go:81—MCPServerCrossRunHealthpkg/cli/gateway_logs_types.go:85—GatewayServerMetricsSuccess Criteria
Source
Extracted from Typist: Go Type Consistency Analysis discussion #50544
Priority
Medium - improves maintainability; estimated 3-4 hours