Skip to content

[Code Quality] refactor: wire mcp_github_config.go and pkg/parser/mcp.go through existing typed configs instead of manual map[string]any assert [Content truncated due to length] #49343

Description

@github-actions

Description

pkg/workflow/mcp_github_config.go has ~10 GitHub-tool accessor functions (getGitHubType, getGitHubToken, getGitHubLockdown, getGitHubToolsets, getGitHubAllowedTools, etc.) that manually type-assert well-known keys out of githubTool map[string]any, even though a matching strongly-typed GitHubToolConfig struct already exists in pkg/workflow/tools_types.go:306. Similarly, pkg/parser/mcp.gos MCP stdio/http config parsing manually pulls fields out of map[string]any even though types.BaseMCPServerConfig (pkg/types/mcp.go:6) already models the same shape.

Suggested Changes

  • Route the GitHub-tool accessor functions in pkg/workflow/mcp_github_config.go through GitHubToolConfig (decode once, then use struct field access) instead of repeated .(string)/.(map[string]any) assertions
  • Decode MCP stdio/http server configs in pkg/parser/mcp.go into types.BaseMCPServerConfig rather than reading ad hoc from map[string]any

Files Affected

  • pkg/workflow/mcp_github_config.go
  • pkg/parser/mcp.go
  • pkg/workflow/tools_types.go (existing GitHubToolConfig, no changes expected)
  • pkg/types/mcp.go (existing BaseMCPServerConfig, no changes expected)

Success Criteria

  • GitHub tool accessor functions no longer perform redundant manual type assertions for fields already modeled by GitHubToolConfig
  • MCP config parsing in pkg/parser/mcp.go uses types.BaseMCPServerConfig where applicable
  • make test-unit and make build pass; no behavior change

Source

Extracted from Typist - Go Type Consistency Analysis discussion #49330 (Priority 1 recommendation, estimated 4-6 hours, high impact)

Priority

Medium-High - removes ~15-20 duplicated type-assertion sites; destination types already exist and are unused at these call sites

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 57.7 AIC · ⌖ 5.34 AIC · ⊞ 10.2K ·

  • expires on Aug 1, 2026, 5:24 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