(t *testing.T)
| 712 | } |
| 713 | |
| 714 | func 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 | |
| 741 | func TestForMCPRequest_ToolsCall(t *testing.T) { |
| 742 | tools := []ServerTool{ |
nothing calls this directly
no test coverage detected