@@ -3,7 +3,7 @@ import { z } from "zod";
33import { ToolBase , type OperationType , type ToolCategory , type ToolConstructorParams } from "../../src/tools/tool.js" ;
44import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js" ;
55import type { Session } from "../../src/common/session.js" ;
6- import type { UserConfig } from "../../src/common/config.js" ;
6+ import type { PreviewFeature , UserConfig } from "../../src/common/config.js" ;
77import type { Telemetry } from "../../src/telemetry/telemetry.js" ;
88import type { Elicitation } from "../../src/elicitation.js" ;
99import type { CompositeLogger } from "../../src/common/logger.js" ;
@@ -32,6 +32,7 @@ describe("ToolBase", () => {
3232
3333 mockConfig = {
3434 confirmationRequiredTools : [ ] ,
35+ previewFeatures : [ ] ,
3536 } as unknown as UserConfig ;
3637
3738 mockTelemetry = { } as Telemetry ;
@@ -100,6 +101,21 @@ describe("ToolBase", () => {
100101 expect ( mockRequestConfirmation ) . toHaveBeenCalledTimes ( 1 ) ;
101102 } ) ;
102103 } ) ;
104+
105+ describe ( "isFeatureEnabled" , ( ) => {
106+ it ( "should return false for any feature by default" , ( ) => {
107+ expect ( testTool [ "isFeatureEnabled" ] ( "vectorSearch" ) ) . to . equal ( false ) ;
108+ expect ( testTool [ "isFeatureEnabled" ] ( "someOtherFeature" as PreviewFeature ) ) . to . equal ( false ) ;
109+ } ) ;
110+
111+ it ( "should return true for enabled features" , ( ) => {
112+ mockConfig . previewFeatures = [ "vectorSearch" , "someOtherFeature" as PreviewFeature ] ;
113+ expect ( testTool [ "isFeatureEnabled" ] ( "vectorSearch" ) ) . to . equal ( true ) ;
114+ expect ( testTool [ "isFeatureEnabled" ] ( "someOtherFeature" as PreviewFeature ) ) . to . equal ( true ) ;
115+
116+ expect ( testTool [ "isFeatureEnabled" ] ( "anotherFeature" as PreviewFeature ) ) . to . equal ( false ) ;
117+ } ) ;
118+ } ) ;
103119} ) ;
104120
105121class TestTool extends ToolBase {
0 commit comments