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

Function TestForMCPRequest_PromptsList

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

Source from the content-addressed store, hash-verified

853 }
854}
855func TestForMCPRequest_PromptsList(t *testing.T) {
856 tools := []ServerTool{
857 mockTool("tool1", "repos", true),
858 }
859 resources := []ServerResourceTemplate{
860 mockResource("res1", "repos", "repo://{owner}/{repo}"),
861 }
862 prompts := []ServerPrompt{
863 mockPrompt("prompt1", "repos"),
864 mockPrompt("prompt2", "issues"),
865 }
866
867 reg := mustBuild(t, NewBuilder().SetTools(tools).SetResources(resources).SetPrompts(prompts).WithToolsets([]string{"all"}))
868 filtered := reg.ForMCPRequest(MCPMethodPromptsList, "")
869
870 if len(filtered.AvailableTools(context.Background())) != 0 {
871 t.Errorf("Expected 0 tools for prompts/list, got %d", len(filtered.AvailableTools(context.Background())))
872 }
873 if len(filtered.AvailableResourceTemplates(context.Background())) != 0 {
874 t.Errorf("Expected 0 resources for prompts/list, got %d", len(filtered.AvailableResourceTemplates(context.Background())))
875 }
876 if len(filtered.AvailablePrompts(context.Background())) != 2 {
877 t.Errorf("Expected 2 prompts for prompts/list, got %d", len(filtered.AvailablePrompts(context.Background())))
878 }
879}
880
881func TestForMCPRequest_PromptsGet(t *testing.T) {
882 prompts := []ServerPrompt{

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