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 · ◷
Description
pkg/workflow/mcp_github_config.gohas ~10 GitHub-tool accessor functions (getGitHubType,getGitHubToken,getGitHubLockdown,getGitHubToolsets,getGitHubAllowedTools, etc.) that manually type-assert well-known keys out ofgithubTool map[string]any, even though a matching strongly-typedGitHubToolConfigstruct already exists inpkg/workflow/tools_types.go:306. Similarly,pkg/parser/mcp.gos MCP stdio/http config parsing manually pulls fields out ofmap[string]anyeven thoughtypes.BaseMCPServerConfig(pkg/types/mcp.go:6) already models the same shape.Suggested Changes
pkg/workflow/mcp_github_config.gothroughGitHubToolConfig(decode once, then use struct field access) instead of repeated.(string)/.(map[string]any)assertionspkg/parser/mcp.gointotypes.BaseMCPServerConfigrather than reading ad hoc frommap[string]anyFiles Affected
pkg/workflow/mcp_github_config.gopkg/parser/mcp.gopkg/workflow/tools_types.go(existingGitHubToolConfig, no changes expected)pkg/types/mcp.go(existingBaseMCPServerConfig, no changes expected)Success Criteria
GitHubToolConfigpkg/parser/mcp.gousestypes.BaseMCPServerConfigwhere applicablemake test-unitandmake buildpass; no behavior changeSource
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