(t *testing.T)
| 381 | } |
| 382 | |
| 383 | func TestWithTools(t *testing.T) { |
| 384 | tools := []ServerTool{ |
| 385 | mockTool("tool1", "toolset1", true), |
| 386 | mockTool("tool2", "toolset1", true), |
| 387 | mockTool("tool3", "toolset2", true), |
| 388 | } |
| 389 | |
| 390 | // WithTools adds additional tools that bypass toolset filtering |
| 391 | // When combined with WithToolsets([]), only the additional tools should be available |
| 392 | filteredReg := mustBuild(t, NewBuilder().SetTools(tools).WithToolsets([]string{}).WithTools([]string{"tool1", "tool3"})) |
| 393 | filteredTools := filteredReg.AvailableTools(context.Background()) |
| 394 | |
| 395 | if len(filteredTools) != 2 { |
| 396 | t.Fatalf("Expected 2 filtered tools, got %d", len(filteredTools)) |
| 397 | } |
| 398 | |
| 399 | toolNames := make(map[string]bool) |
| 400 | for _, tool := range filteredTools { |
| 401 | toolNames[tool.Tool.Name] = true |
| 402 | } |
| 403 | if !toolNames["tool1"] || !toolNames["tool3"] { |
| 404 | t.Errorf("Expected tool1 and tool3, got %v", toolNames) |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | func TestChainedFilters(t *testing.T) { |
| 409 | tools := []ServerTool{ |
nothing calls this directly
no test coverage detected