(t *testing.T)
| 122 | } |
| 123 | |
| 124 | func TestWithReadOnly(t *testing.T) { |
| 125 | tools := []ServerTool{ |
| 126 | mockTool("read_tool", "toolset1", true), |
| 127 | mockTool("write_tool", "toolset1", false), |
| 128 | } |
| 129 | |
| 130 | // Build without read-only - should have both tools |
| 131 | reg := mustBuild(t, NewBuilder().SetTools(tools).WithToolsets([]string{"all"})) |
| 132 | allTools := reg.AvailableTools(context.Background()) |
| 133 | if len(allTools) != 2 { |
| 134 | t.Fatalf("Expected 2 tools without read-only, got %d", len(allTools)) |
| 135 | } |
| 136 | |
| 137 | // Build with read-only - should filter out write tools |
| 138 | readOnlyReg := mustBuild(t, NewBuilder().SetTools(tools).WithToolsets([]string{"all"}).WithReadOnly(true)) |
| 139 | readOnlyTools := readOnlyReg.AvailableTools(context.Background()) |
| 140 | if len(readOnlyTools) != 1 { |
| 141 | t.Fatalf("Expected 1 tool in read-only, got %d", len(readOnlyTools)) |
| 142 | } |
| 143 | if readOnlyTools[0].Tool.Name != "read_tool" { |
| 144 | t.Errorf("Expected read_tool, got %s", readOnlyTools[0].Tool.Name) |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | func TestWithToolsets(t *testing.T) { |
| 149 | tools := []ServerTool{ |
nothing calls this directly
no test coverage detected