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

Function TestForMCPRequest_ToolsCall

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

Source from the content-addressed store, hash-verified

739}
740
741func TestForMCPRequest_ToolsCall(t *testing.T) {
742 tools := []ServerTool{
743 mockTool("get_me", "context", true),
744 mockTool("create_issue", "issues", false),
745 mockTool("list_repos", "repos", true),
746 }
747
748 reg := mustBuild(t, NewBuilder().SetTools(tools).WithToolsets([]string{"all"}))
749 filtered := reg.ForMCPRequest(MCPMethodToolsCall, "get_me")
750
751 available := filtered.AvailableTools(context.Background())
752 if len(available) != 1 {
753 t.Fatalf("Expected 1 tool for tools/call with name, got %d", len(available))
754 }
755 if available[0].Tool.Name != "get_me" {
756 t.Errorf("Expected tool name 'get_me', got %q", available[0].Tool.Name)
757 }
758}
759
760func TestForMCPRequest_ToolsCall_NotFound(t *testing.T) {
761 tools := []ServerTool{

Callers

nothing calls this directly

Calls 7

mustBuildFunction · 0.85
NewBuilderFunction · 0.85
WithToolsetsMethod · 0.80
SetToolsMethod · 0.80
ForMCPRequestMethod · 0.80
AvailableToolsMethod · 0.80
mockToolFunction · 0.70

Tested by

no test coverage detected