55using System . Text . Json ;
66using AwesomeAssertions ;
77using Elastic . Documentation . Mcp . Remote . Responses ;
8+ using ModelContextProtocol . Protocol ;
89
910namespace Mcp . Remote . IntegrationTests ;
1011
@@ -24,9 +25,10 @@ public async Task SemanticSearch_ReturnsResults()
2425 Assert . SkipUnless ( canConnect , "Elasticsearch is not connected" ) ;
2526
2627 // Act
27- var resultJson = await searchTools . SemanticSearch (
28+ var result = await searchTools . SemanticSearch (
2829 "elasticsearch getting started" ,
2930 cancellationToken : TestContext . Current . CancellationToken ) ;
31+ var resultJson = ( ( TextContentBlock ) result . Content [ 0 ] ) . Text ;
3032
3133 // Assert
3234 Output . WriteLine ( $ "Result: { resultJson } ") ;
@@ -53,10 +55,11 @@ public async Task SemanticSearch_WithProductFilter()
5355 Assert . SkipUnless ( canConnect , "Elasticsearch is not connected" ) ;
5456
5557 // Act
56- var resultJson = await searchTools . SemanticSearch (
58+ var result = await searchTools . SemanticSearch (
5759 "getting started" ,
5860 productFilter : "elasticsearch" ,
5961 cancellationToken : TestContext . Current . CancellationToken ) ;
62+ var resultJson = ( ( TextContentBlock ) result . Content [ 0 ] ) . Text ;
6063
6164 // Assert
6265 Output . WriteLine ( $ "Result: { resultJson } ") ;
@@ -81,10 +84,11 @@ public async Task FindRelatedDocs_ReturnsRelated()
8184 Assert . SkipUnless ( canConnect , "Elasticsearch is not connected" ) ;
8285
8386 // Act
84- var resultJson = await searchTools . FindRelatedDocs (
87+ var result = await searchTools . FindRelatedDocs (
8588 "data streams" ,
8689 limit : 5 ,
8790 cancellationToken : TestContext . Current . CancellationToken ) ;
91+ var resultJson = ( ( TextContentBlock ) result . Content [ 0 ] ) . Text ;
8892
8993 // Assert
9094 Output . WriteLine ( $ "Result: { resultJson } ") ;
0 commit comments