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

Function TestFindToolByName

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

Source from the content-addressed store, hash-verified

517}
518
519func TestFindToolByName(t *testing.T) {
520 tools := []ServerTool{
521 mockTool("issue_read", "toolset1", true),
522 }
523
524 reg := mustBuild(t, NewBuilder().SetTools(tools))
525
526 // Find by name
527 tool, toolsetID, err := reg.FindToolByName("issue_read")
528 if err != nil {
529 t.Fatalf("expected no error, got %v", err)
530 }
531 if tool.Tool.Name != "issue_read" {
532 t.Errorf("expected tool name 'issue_read', got '%s'", tool.Tool.Name)
533 }
534 if toolsetID != "toolset1" {
535 t.Errorf("expected toolset ID 'toolset1', got '%s'", toolsetID)
536 }
537
538 // Non-existent tool
539 _, _, err = reg.FindToolByName("nonexistent")
540 if err == nil {
541 t.Error("expected error for non-existent tool")
542 }
543}
544
545func TestWithToolsAdditive(t *testing.T) {
546 tools := []ServerTool{

Callers

nothing calls this directly

Calls 6

mustBuildFunction · 0.85
NewBuilderFunction · 0.85
SetToolsMethod · 0.80
FindToolByNameMethod · 0.80
mockToolFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected