Skip to content

[Code Quality] Consolidate 3 duplicated per-tool aggregate call stats structs in pkg/cli #50677

Description

@github-actions

Description

The "per-tool aggregate call stats" concept is modeled three separate times under different naming conventions, all carrying the same call-count/size/duration/error fields.

Suggested Changes

  • Apply the same base-struct treatment as the MCP-server-stats consolidation (companion issue): introduce a shared base for call-count, size, duration and error fields.
  • Do this together with the MCP-server-stats work since they share call sites in the audit report generators.

Files Affected

  • pkg/cli/audit_report.go:166ToolUsageInfo
  • pkg/cli/audit_report.go:184MCPToolSummary
  • pkg/cli/gateway_logs_types.go:97GatewayToolMetrics

Note: ToolUsageInfo may already be tracked for removal via #40803 in favor of workflow.ToolCallInfo — verify against that issue before duplicating scope, and prefer consolidating MCPToolSummary/GatewayToolMetrics around whichever canonical type wins.

Success Criteria

  • Single canonical base/type for per-tool aggregate stats used across audit and gateway reports
  • No behavior change in generated reports
  • All existing tests pass

Source

Extracted from Typist: Go Type Consistency Analysis discussion #50544

Priority

Medium-High - companion to MCP-server-stats consolidation; estimated 2-3 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

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