@@ -151,7 +151,17 @@ describe("useMcpToolTool", () => {
151151
152152 expect ( mockTask . consecutiveMistakeCount ) . toBe ( 1 )
153153 expect ( mockTask . recordToolError ) . toHaveBeenCalledWith ( "use_mcp_tool" )
154- expect ( mockTask . say ) . toHaveBeenCalledWith ( "error" , expect . stringContaining ( "invalid JSON argument" ) )
154+ expect ( mockTask . say ) . toHaveBeenCalledWith (
155+ "error" ,
156+ expect . stringContaining ( "invalid JSON argument" ) ,
157+ undefined ,
158+ undefined ,
159+ undefined ,
160+ undefined ,
161+ {
162+ metadata : { title : "Invalid JSON Arguments" } ,
163+ } ,
164+ )
155165 expect ( mockPushToolResult ) . toHaveBeenCalledWith ( "Tool error: Invalid args for test_server:test_tool" )
156166 } )
157167 } )
@@ -343,7 +353,17 @@ describe("useMcpToolTool", () => {
343353
344354 expect ( mockTask . consecutiveMistakeCount ) . toBe ( 1 )
345355 expect ( mockTask . recordToolError ) . toHaveBeenCalledWith ( "use_mcp_tool" )
346- expect ( mockTask . say ) . toHaveBeenCalledWith ( "error" , expect . stringContaining ( "does not exist" ) )
356+ expect ( mockTask . say ) . toHaveBeenCalledWith (
357+ "error" ,
358+ expect . stringContaining ( "does not exist" ) ,
359+ undefined ,
360+ undefined ,
361+ undefined ,
362+ undefined ,
363+ {
364+ metadata : { title : "MCP Tool Not Found" } ,
365+ } ,
366+ )
347367 // Check that the error message contains available tools
348368 expect ( mockPushToolResult ) . toHaveBeenCalledWith ( expect . stringContaining ( "existing-tool-1" ) )
349369 expect ( mockPushToolResult ) . toHaveBeenCalledWith ( expect . stringContaining ( "existing-tool-2" ) )
@@ -390,7 +410,17 @@ describe("useMcpToolTool", () => {
390410
391411 expect ( mockTask . consecutiveMistakeCount ) . toBe ( 1 )
392412 expect ( mockTask . recordToolError ) . toHaveBeenCalledWith ( "use_mcp_tool" )
393- expect ( mockTask . say ) . toHaveBeenCalledWith ( "error" , expect . stringContaining ( "does not exist" ) )
413+ expect ( mockTask . say ) . toHaveBeenCalledWith (
414+ "error" ,
415+ expect . stringContaining ( "does not exist" ) ,
416+ undefined ,
417+ undefined ,
418+ undefined ,
419+ undefined ,
420+ {
421+ metadata : { title : "MCP Tool Not Found" } ,
422+ } ,
423+ )
394424 expect ( mockPushToolResult ) . toHaveBeenCalledWith ( expect . stringContaining ( "No tools available" ) )
395425 } )
396426
@@ -484,7 +514,17 @@ describe("useMcpToolTool", () => {
484514 // Assert
485515 expect ( mockTask . consecutiveMistakeCount ) . toBe ( 1 )
486516 expect ( mockTask . recordToolError ) . toHaveBeenCalledWith ( "use_mcp_tool" )
487- expect ( mockTask . say ) . toHaveBeenCalledWith ( "error" , expect . stringContaining ( "not configured" ) )
517+ expect ( mockTask . say ) . toHaveBeenCalledWith (
518+ "error" ,
519+ expect . stringContaining ( "not configured" ) ,
520+ undefined ,
521+ undefined ,
522+ undefined ,
523+ undefined ,
524+ {
525+ metadata : { title : "MCP Server Not Found" } ,
526+ } ,
527+ )
488528 expect ( mockPushToolResult ) . toHaveBeenCalledWith ( expect . stringContaining ( "s1" ) )
489529 expect ( callToolMock ) . not . toHaveBeenCalled ( )
490530 expect ( mockAskApproval ) . not . toHaveBeenCalled ( )
@@ -527,7 +567,17 @@ describe("useMcpToolTool", () => {
527567 // Assert
528568 expect ( mockTask . consecutiveMistakeCount ) . toBe ( 1 )
529569 expect ( mockTask . recordToolError ) . toHaveBeenCalledWith ( "use_mcp_tool" )
530- expect ( mockTask . say ) . toHaveBeenCalledWith ( "error" , expect . stringContaining ( "not configured" ) )
570+ expect ( mockTask . say ) . toHaveBeenCalledWith (
571+ "error" ,
572+ expect . stringContaining ( "not configured" ) ,
573+ undefined ,
574+ undefined ,
575+ undefined ,
576+ undefined ,
577+ {
578+ metadata : { title : "MCP Server Not Found" } ,
579+ } ,
580+ )
531581 expect ( mockPushToolResult ) . toHaveBeenCalledWith ( expect . stringContaining ( "No servers available" ) )
532582 expect ( callToolMock ) . not . toHaveBeenCalled ( )
533583 expect ( mockAskApproval ) . not . toHaveBeenCalled ( )
0 commit comments