@@ -48,7 +48,7 @@ describe('Registration Index Files', () => {
4848 it ( 'should register conditional tools based on capabilities' , async ( ) => {
4949 const { registerConditionalTools } = await import ( '../tools/index.js' ) ;
5050
51- // Server with all capabilities
51+ // Server with all capabilities including experimental tasks API
5252 const mockServerWithCapabilities = {
5353 registerTool : vi . fn ( ) ,
5454 server : {
@@ -58,11 +58,16 @@ describe('Registration Index Files', () => {
5858 sampling : { } ,
5959 } ) ) ,
6060 } ,
61+ experimental : {
62+ tasks : {
63+ registerToolTask : vi . fn ( ) ,
64+ } ,
65+ } ,
6166 } as unknown as McpServer ;
6267
6368 registerConditionalTools ( mockServerWithCapabilities ) ;
6469
65- // Should register 3 conditional tools when all capabilities present
70+ // Should register 3 conditional tools + 3 task-based tools when all capabilities present
6671 expect ( mockServerWithCapabilities . registerTool ) . toHaveBeenCalledTimes ( 3 ) ;
6772
6873 const registeredTools = (
@@ -71,6 +76,9 @@ describe('Registration Index Files', () => {
7176 expect ( registeredTools ) . toContain ( 'get-roots-list' ) ;
7277 expect ( registeredTools ) . toContain ( 'trigger-elicitation-request' ) ;
7378 expect ( registeredTools ) . toContain ( 'trigger-sampling-request' ) ;
79+
80+ // Task-based tools are registered via experimental.tasks.registerToolTask
81+ expect ( mockServerWithCapabilities . experimental . tasks . registerToolTask ) . toHaveBeenCalled ( ) ;
7482 } ) ;
7583
7684 it ( 'should not register conditional tools when capabilities missing' , async ( ) => {
@@ -81,11 +89,16 @@ describe('Registration Index Files', () => {
8189 server : {
8290 getClientCapabilities : vi . fn ( ( ) => ( { } ) ) ,
8391 } ,
92+ experimental : {
93+ tasks : {
94+ registerToolTask : vi . fn ( ) ,
95+ } ,
96+ } ,
8497 } as unknown as McpServer ;
8598
8699 registerConditionalTools ( mockServerNoCapabilities ) ;
87100
88- // Should not register any tools when capabilities are missing
101+ // Should not register any capability-gated tools when capabilities are missing
89102 expect ( mockServerNoCapabilities . registerTool ) . not . toHaveBeenCalled ( ) ;
90103 } ) ;
91104 } ) ;
0 commit comments