MCPcopy Index your code
hub / github.com/github/github-mcp-server / TestNoDuplicateToolNames

Function TestNoDuplicateToolNames

pkg/github/tools_validation_test.go:106–133  ·  view source on GitHub ↗

TestNoDuplicateToolNames ensures all tools have unique names

(t *testing.T)

Source from the content-addressed store, hash-verified

104
105// TestNoDuplicateToolNames ensures all tools have unique names
106func TestNoDuplicateToolNames(t *testing.T) {
107 tools := AllTools(stubTranslation)
108 seen := make(map[string]bool)
109 featureFlagged := make(map[string]bool)
110
111 // get_label is intentionally in both issues and labels toolsets for conformance
112 // with original behavior where it was registered in both
113 allowedDuplicates := map[string]bool{
114 "get_label": true,
115 }
116
117 // First pass: identify tools that have feature flags (mutually exclusive at runtime)
118 for _, tool := range tools {
119 if tool.FeatureFlagEnable != "" || len(tool.FeatureFlagDisable) > 0 {
120 featureFlagged[tool.Tool.Name] = true
121 }
122 }
123
124 for _, tool := range tools {
125 name := tool.Tool.Name
126 // Allow duplicates for explicitly allowed tools and feature-flagged tools
127 if !allowedDuplicates[name] && !featureFlagged[name] {
128 assert.False(t, seen[name],
129 "Duplicate tool name found: %q", name)
130 }
131 seen[name] = true
132 }
133}
134
135// TestNoDuplicateResourceNames ensures all resources have unique names
136func TestNoDuplicateResourceNames(t *testing.T) {

Callers

nothing calls this directly

Calls 1

AllToolsFunction · 0.85

Tested by

no test coverage detected