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

Function TestForMCPRequest_ResourcesList

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

Source from the content-addressed store, hash-verified

811}
812
813func TestForMCPRequest_ResourcesList(t *testing.T) {
814 tools := []ServerTool{
815 mockTool("tool1", "repos", true),
816 }
817 resources := []ServerResourceTemplate{
818 mockResource("res1", "repos", "repo://{owner}/{repo}"),
819 mockResource("res2", "repos", "branch://{owner}/{repo}/{branch}"),
820 }
821 prompts := []ServerPrompt{
822 mockPrompt("prompt1", "repos"),
823 }
824
825 reg := mustBuild(t, NewBuilder().SetTools(tools).SetResources(resources).SetPrompts(prompts).WithToolsets([]string{"all"}))
826 filtered := reg.ForMCPRequest(MCPMethodResourcesList, "")
827
828 if len(filtered.AvailableTools(context.Background())) != 0 {
829 t.Errorf("Expected 0 tools for resources/list, got %d", len(filtered.AvailableTools(context.Background())))
830 }
831 if len(filtered.AvailableResourceTemplates(context.Background())) != 2 {
832 t.Errorf("Expected 2 resources for resources/list, got %d", len(filtered.AvailableResourceTemplates(context.Background())))
833 }
834 if len(filtered.AvailablePrompts(context.Background())) != 0 {
835 t.Errorf("Expected 0 prompts for resources/list, got %d", len(filtered.AvailablePrompts(context.Background())))
836 }
837}
838
839func TestForMCPRequest_ResourcesRead(t *testing.T) {
840 resources := []ServerResourceTemplate{

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