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

Function TestForMCPRequest_ToolsList

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

Source from the content-addressed store, hash-verified

712}
713
714func TestForMCPRequest_ToolsList(t *testing.T) {
715 tools := []ServerTool{
716 mockTool("tool1", "repos", true),
717 mockTool("tool2", "issues", true),
718 }
719 resources := []ServerResourceTemplate{
720 mockResource("res1", "repos", "repo://{owner}/{repo}"),
721 }
722 prompts := []ServerPrompt{
723 mockPrompt("prompt1", "repos"),
724 }
725
726 reg := mustBuild(t, NewBuilder().SetTools(tools).SetResources(resources).SetPrompts(prompts).WithToolsets([]string{"all"}))
727 filtered := reg.ForMCPRequest(MCPMethodToolsList, "")
728
729 // tools/list should return all tools, no resources or prompts
730 if len(filtered.AvailableTools(context.Background())) != 2 {
731 t.Errorf("Expected 2 tools for tools/list, got %d", len(filtered.AvailableTools(context.Background())))
732 }
733 if len(filtered.AvailableResourceTemplates(context.Background())) != 0 {
734 t.Errorf("Expected 0 resources for tools/list, got %d", len(filtered.AvailableResourceTemplates(context.Background())))
735 }
736 if len(filtered.AvailablePrompts(context.Background())) != 0 {
737 t.Errorf("Expected 0 prompts for tools/list, got %d", len(filtered.AvailablePrompts(context.Background())))
738 }
739}
740
741func TestForMCPRequest_ToolsCall(t *testing.T) {
742 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