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

Function AddDefaultToolset

pkg/github/tools.go:420–446  ·  view source on GitHub ↗

AddDefaultToolset removes the default toolset and expands it to the actual default toolset IDs

(result []string)

Source from the content-addressed store, hash-verified

418
419// AddDefaultToolset removes the default toolset and expands it to the actual default toolset IDs
420func AddDefaultToolset(result []string) []string {
421 hasDefault := false
422 seen := make(map[string]bool)
423 for _, toolset := range result {
424 seen[toolset] = true
425 if toolset == string(ToolsetMetadataDefault.ID) {
426 hasDefault = true
427 }
428 }
429
430 // Only expand if "default" keyword was found
431 if !hasDefault {
432 return result
433 }
434
435 result = RemoveToolset(result, string(ToolsetMetadataDefault.ID))
436
437 // Get default toolset IDs from the Inventory
438 // Build() can only fail if WithTools specifies invalid tools - not used here
439 r, _ := NewInventory(stubTranslator).Build()
440 for _, id := range r.DefaultToolsetIDs() {
441 if !seen[string(id)] {
442 result = append(result, string(id))
443 }
444 }
445 return result
446}
447
448func RemoveToolset(tools []string, toRemove string) []string {
449 result := make([]string, 0, len(tools))

Callers 1

TestAddDefaultToolsetFunction · 0.85

Calls 4

RemoveToolsetFunction · 0.85
NewInventoryFunction · 0.85
BuildMethod · 0.80
DefaultToolsetIDsMethod · 0.80

Tested by 1

TestAddDefaultToolsetFunction · 0.68