(t *testing.T)
| 811 | } |
| 812 | |
| 813 | func 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 | |
| 839 | func TestForMCPRequest_ResourcesRead(t *testing.T) { |
| 840 | resources := []ServerResourceTemplate{ |
nothing calls this directly
no test coverage detected