(t *testing.T)
| 1186 | } |
| 1187 | |
| 1188 | func TestFeatureFlagPrompts(t *testing.T) { |
| 1189 | prompts := []ServerPrompt{ |
| 1190 | mockPrompt("always_available", "toolset1"), |
| 1191 | { |
| 1192 | Prompt: mcp.Prompt{Name: "needs_flag"}, |
| 1193 | Toolset: testToolsetMetadata("toolset1"), |
| 1194 | FeatureFlagEnable: "my_feature", |
| 1195 | }, |
| 1196 | } |
| 1197 | |
| 1198 | // Without checker, feature-flag filtering is skipped: both prompts pass |
| 1199 | reg := mustBuild(t, NewBuilder().SetPrompts(prompts).WithToolsets([]string{"all"})) |
| 1200 | available := reg.AvailablePrompts(context.Background()) |
| 1201 | if len(available) != 2 { |
| 1202 | t.Fatalf("Expected 2 prompts without checker (filtering skipped), got %d", len(available)) |
| 1203 | } |
| 1204 | |
| 1205 | // With checker returning true, both should be included |
| 1206 | checker := func(_ context.Context, _ string) (bool, error) { return true, nil } |
| 1207 | regWithChecker := mustBuild(t, NewBuilder().SetPrompts(prompts).WithToolsets([]string{"all"}).WithFeatureChecker(checker)) |
| 1208 | if len(regWithChecker.AvailablePrompts(context.Background())) != 2 { |
| 1209 | t.Errorf("Expected 2 prompts with checker, got %d", len(regWithChecker.AvailablePrompts(context.Background()))) |
| 1210 | } |
| 1211 | } |
| 1212 | |
| 1213 | func TestServerToolHasHandler(t *testing.T) { |
| 1214 | // Tool with handler |
nothing calls this directly
no test coverage detected