@@ -350,8 +350,8 @@ describe('Task Lifecycle Integration Tests', () => {
350350 let task = await taskStore . getTask ( taskId ) ;
351351 expect ( task ?. status ) . toBe ( 'working' ) ;
352352
353- // Cancel the task via client.cancelTask - per spec, returns Result & Task
354- const cancelResult = await client . cancelTask ( { taskId } ) ;
353+ // Cancel the task via client.experimental.tasks. cancelTask - per spec, returns Result & Task
354+ const cancelResult = await client . experimental . tasks . cancelTask ( taskId ) ;
355355
356356 // Verify the cancel response includes the cancelled task (per MCP spec CancelTaskResult is Result & Task)
357357 expect ( cancelResult . taskId ) . toBe ( taskId ) ;
@@ -403,7 +403,7 @@ describe('Task Lifecycle Integration Tests', () => {
403403 expect ( task ?. status ) . toBe ( 'completed' ) ;
404404
405405 // Try to cancel via tasks/cancel request (should fail with -32602)
406- await expect ( client . cancelTask ( { taskId } ) ) . rejects . toSatisfy ( ( error : McpError ) => {
406+ await expect ( client . experimental . tasks . cancelTask ( taskId ) ) . rejects . toSatisfy ( ( error : McpError ) => {
407407 expect ( error ) . toBeInstanceOf ( McpError ) ;
408408 expect ( error . code ) . toBe ( ErrorCode . InvalidParams ) ;
409409 expect ( error . message ) . toContain ( 'Cannot cancel task in terminal status' ) ;
@@ -799,7 +799,7 @@ describe('Task Lifecycle Integration Tests', () => {
799799 await client . connect ( transport ) ;
800800
801801 // Try to get non-existent task via tasks/get request
802- await expect ( client . getTask ( { taskId : 'non-existent-task-id' } ) ) . rejects . toSatisfy ( ( error : McpError ) => {
802+ await expect ( client . experimental . tasks . getTask ( 'non-existent-task-id' ) ) . rejects . toSatisfy ( ( error : McpError ) => {
803803 expect ( error ) . toBeInstanceOf ( McpError ) ;
804804 expect ( error . code ) . toBe ( ErrorCode . InvalidParams ) ;
805805 expect ( error . message ) . toContain ( 'Task not found' ) ;
@@ -819,7 +819,7 @@ describe('Task Lifecycle Integration Tests', () => {
819819 await client . connect ( transport ) ;
820820
821821 // Try to cancel non-existent task via tasks/cancel request
822- await expect ( client . cancelTask ( { taskId : 'non-existent-task-id' } ) ) . rejects . toSatisfy ( ( error : McpError ) => {
822+ await expect ( client . experimental . tasks . cancelTask ( 'non-existent-task-id' ) ) . rejects . toSatisfy ( ( error : McpError ) => {
823823 expect ( error ) . toBeInstanceOf ( McpError ) ;
824824 expect ( error . code ) . toBe ( ErrorCode . InvalidParams ) ;
825825 expect ( error . message ) . toContain ( 'Task not found' ) ;
0 commit comments