@@ -434,63 +434,5 @@ describe('MCP Server Semantic Conventions', () => {
434434 expect ( setStatusSpy ) . not . toHaveBeenCalled ( ) ;
435435 expect ( endSpy ) . toHaveBeenCalled ( ) ;
436436 } ) ;
437-
438- it ( 'should set span status to ERROR when tool result has isError: true' , async ( ) => {
439- await wrappedMcpServer . connect ( mockTransport ) ;
440-
441- const setAttributesSpy = vi . fn ( ) ;
442- const setStatusSpy = vi . fn ( ) ;
443- const endSpy = vi . fn ( ) ;
444- const mockSpan = {
445- setAttributes : setAttributesSpy ,
446- setStatus : setStatusSpy ,
447- end : endSpy ,
448- } as unknown as ReturnType < typeof tracingModule . startInactiveSpan > ;
449- startInactiveSpanSpy . mockReturnValueOnce ( mockSpan ) ;
450-
451- const toolCallRequest = {
452- jsonrpc : '2.0' ,
453- method : 'tools/call' ,
454- id : 'req-tool-error' ,
455- params : {
456- name : 'failing-tool' ,
457- arguments : { input : 'test' } ,
458- } ,
459- } ;
460-
461- // Simulate the incoming tool call request
462- mockTransport . onmessage ?.( toolCallRequest , { } ) ;
463-
464- // Simulate tool execution response with error
465- const toolErrorResponse = {
466- jsonrpc : '2.0' ,
467- id : 'req-tool-error' ,
468- result : {
469- content : [
470- {
471- type : 'text' ,
472- text : 'Tool execution failed' ,
473- } ,
474- ] ,
475- isError : true ,
476- } ,
477- } ;
478-
479- // Simulate the outgoing response (this should trigger span completion)
480- mockTransport . send ?.( toolErrorResponse ) ;
481-
482- // Verify that the span was enriched with tool result attributes including error
483- expect ( setAttributesSpy ) . toHaveBeenCalledWith (
484- expect . objectContaining ( {
485- 'mcp.tool.result.is_error' : true ,
486- 'mcp.tool.result.content_count' : 1 ,
487- 'mcp.tool.result.content_type' : 'text' ,
488- 'mcp.tool.result.content' : 'Tool execution failed' ,
489- } ) ,
490- ) ;
491-
492- expect ( setStatusSpy ) . not . toHaveBeenCalled ( ) ;
493- expect ( endSpy ) . toHaveBeenCalled ( ) ;
494- } ) ;
495437 } ) ;
496438} ) ;
0 commit comments