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

Function TestResolveToolAliases

pkg/inventory/registry_test.go:486–517  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

484}
485
486func TestResolveToolAliases(t *testing.T) {
487 tools := []ServerTool{
488 mockTool("issue_read", "toolset1", true),
489 mockTool("some_tool", "toolset1", true),
490 }
491
492 reg := mustBuild(t, NewBuilder().SetTools(tools).
493 WithDeprecatedAliases(map[string]string{
494 "get_issue": "issue_read",
495 }))
496
497 // Test resolving a mix of aliases and canonical names
498 input := []string{"get_issue", "some_tool"}
499 resolved, aliasesUsed := reg.ResolveToolAliases(input)
500
501 if len(resolved) != 2 {
502 t.Fatalf("expected 2 resolved names, got %d", len(resolved))
503 }
504 if resolved[0] != "issue_read" {
505 t.Errorf("expected 'issue_read', got '%s'", resolved[0])
506 }
507 if resolved[1] != "some_tool" {
508 t.Errorf("expected 'some_tool' (unchanged), got '%s'", resolved[1])
509 }
510
511 if len(aliasesUsed) != 1 {
512 t.Fatalf("expected 1 alias used, got %d", len(aliasesUsed))
513 }
514 if aliasesUsed["get_issue"] != "issue_read" {
515 t.Errorf("expected aliasesUsed['get_issue'] = 'issue_read', got '%s'", aliasesUsed["get_issue"])
516 }
517}
518
519func TestFindToolByName(t *testing.T) {
520 tools := []ServerTool{

Callers

nothing calls this directly

Calls 6

mustBuildFunction · 0.85
NewBuilderFunction · 0.85
WithDeprecatedAliasesMethod · 0.80
SetToolsMethod · 0.80
ResolveToolAliasesMethod · 0.80
mockToolFunction · 0.70

Tested by

no test coverage detected