@@ -1899,6 +1899,40 @@ func TestWithInsidersMode_EnabledPreservesUIMetadata(t *testing.T) {
18991899 }
19001900}
19011901
1902+ func TestWithInsidersMode_EnabledPreservesInsidersOnlyTools (t * testing.T ) {
1903+ normalTool := mockTool ("normal" , "toolset1" , true )
1904+ insidersTool := mockTool ("insiders_only" , "toolset1" , true )
1905+ insidersTool .InsidersOnly = true
1906+
1907+ // With insiders mode enabled, both tools should be available
1908+ reg := mustBuild (t , NewBuilder ().
1909+ SetTools ([]ServerTool {normalTool , insidersTool }).
1910+ WithToolsets ([]string {"all" }).
1911+ WithInsidersMode (true ))
1912+ available := reg .AvailableTools (context .Background ())
1913+
1914+ require .Len (t , available , 2 )
1915+ names := []string {available [0 ].Tool .Name , available [1 ].Tool .Name }
1916+ require .Contains (t , names , "normal" )
1917+ require .Contains (t , names , "insiders_only" )
1918+ }
1919+
1920+ func TestWithInsidersMode_DisabledRemovesInsidersOnlyTools (t * testing.T ) {
1921+ normalTool := mockTool ("normal" , "toolset1" , true )
1922+ insidersTool := mockTool ("insiders_only" , "toolset1" , true )
1923+ insidersTool .InsidersOnly = true
1924+
1925+ // With insiders mode disabled, insiders-only tool should be removed
1926+ reg := mustBuild (t , NewBuilder ().
1927+ SetTools ([]ServerTool {normalTool , insidersTool }).
1928+ WithToolsets ([]string {"all" }).
1929+ WithInsidersMode (false ))
1930+ available := reg .AvailableTools (context .Background ())
1931+
1932+ require .Len (t , available , 1 )
1933+ require .Equal (t , "normal" , available [0 ].Tool .Name )
1934+ }
1935+
19021936func TestWithInsidersMode_ToolsWithoutUIMetaUnaffected (t * testing.T ) {
19031937 toolNoUI := mockToolWithMeta ("tool_no_ui" , "toolset1" , map [string ]any {
19041938 "description" : "kept" ,
@@ -2038,6 +2072,23 @@ func TestStripInsidersFeatures(t *testing.T) {
20382072 require .Nil (t , result [2 ].Tool .Meta )
20392073}
20402074
2075+ func TestStripInsidersFeatures_RemovesInsidersOnlyTools (t * testing.T ) {
2076+ // Create tools: one normal, one insiders-only, one normal
2077+ normalTool1 := mockTool ("normal1" , "toolset1" , true )
2078+ insidersTool := mockTool ("insiders_only" , "toolset1" , true )
2079+ insidersTool .InsidersOnly = true
2080+ normalTool2 := mockTool ("normal2" , "toolset1" , true )
2081+
2082+ tools := []ServerTool {normalTool1 , insidersTool , normalTool2 }
2083+
2084+ result := stripInsidersFeatures (tools )
2085+
2086+ // Should only have 2 tools (insiders-only tool filtered out)
2087+ require .Len (t , result , 2 )
2088+ require .Equal (t , "normal1" , result [0 ].Tool .Name )
2089+ require .Equal (t , "normal2" , result [1 ].Tool .Name )
2090+ }
2091+
20412092func TestInsidersOnlyMetaKeys_FutureAdditions (t * testing.T ) {
20422093 // This test verifies the mechanism works for multiple keys
20432094 // If we add new experimental keys to insidersOnlyMetaKeys, they should be stripped
0 commit comments