MCPcopy
hub / github.com/github/github-mcp-server / TestForMCPRequest_Initialize

Function TestForMCPRequest_Initialize

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

Source from the content-addressed store, hash-verified

685}
686
687func TestForMCPRequest_Initialize(t *testing.T) {
688 tools := []ServerTool{
689 mockTool("tool1", "repos", true),
690 mockTool("tool2", "issues", false),
691 }
692 resources := []ServerResourceTemplate{
693 mockResource("res1", "repos", "repo://{owner}/{repo}"),
694 }
695 prompts := []ServerPrompt{
696 mockPrompt("prompt1", "repos"),
697 }
698
699 reg := mustBuild(t, NewBuilder().SetTools(tools).SetResources(resources).SetPrompts(prompts).WithToolsets([]string{"all"}))
700 filtered := reg.ForMCPRequest(MCPMethodInitialize, "")
701
702 // Initialize should return empty - capabilities come from ServerOptions
703 if len(filtered.AvailableTools(context.Background())) != 0 {
704 t.Errorf("Expected 0 tools for initialize, got %d", len(filtered.AvailableTools(context.Background())))
705 }
706 if len(filtered.AvailableResourceTemplates(context.Background())) != 0 {
707 t.Errorf("Expected 0 resources for initialize, got %d", len(filtered.AvailableResourceTemplates(context.Background())))
708 }
709 if len(filtered.AvailablePrompts(context.Background())) != 0 {
710 t.Errorf("Expected 0 prompts for initialize, got %d", len(filtered.AvailablePrompts(context.Background())))
711 }
712}
713
714func TestForMCPRequest_ToolsList(t *testing.T) {
715 tools := []ServerTool{

Callers

nothing calls this directly

Calls 13

mockResourceFunction · 0.85
mockPromptFunction · 0.85
mustBuildFunction · 0.85
NewBuilderFunction · 0.85
WithToolsetsMethod · 0.80
SetPromptsMethod · 0.80
SetResourcesMethod · 0.80
SetToolsMethod · 0.80
ForMCPRequestMethod · 0.80
AvailableToolsMethod · 0.80
AvailablePromptsMethod · 0.80

Tested by

no test coverage detected