File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
src/ModelContextProtocol.Core/Server
tests/ModelContextProtocol.Tests/Server Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -427,18 +427,18 @@ private static void ValidateToolName(string name)
427427 // When structured content is disabled, try to extract the return description from ReturnJsonSchema
428428 // and append it to the tool description so the information is available to consumers
429429 string ? returnDescription = GetReturnDescription ( function . ReturnJsonSchema ) ;
430- if ( returnDescription is null )
430+ if ( string . IsNullOrWhiteSpace ( returnDescription ) )
431431 {
432432 return description ;
433433 }
434434
435435 // Synthesize a combined description
436- if ( string . IsNullOrEmpty ( description ) )
436+ if ( string . IsNullOrWhiteSpace ( description ) )
437437 {
438438 return $ "Returns: { returnDescription } ";
439439 }
440440
441- return $ "{ description } Returns : { returnDescription } ";
441+ return $ "{ description } \n Returns : { returnDescription } ";
442442 }
443443
444444 /// <summary>
@@ -447,9 +447,9 @@ private static void ValidateToolName(string name)
447447 private static string ? GetReturnDescription ( JsonElement ? returnJsonSchema )
448448 {
449449 if ( returnJsonSchema is not JsonElement schema ||
450- schema . ValueKind != JsonValueKind . Object ||
450+ schema . ValueKind is not JsonValueKind . Object ||
451451 ! schema . TryGetProperty ( "description" , out JsonElement descriptionElement ) ||
452- descriptionElement . ValueKind != JsonValueKind . String )
452+ descriptionElement . ValueKind is not JsonValueKind . String )
453453 {
454454 return null ;
455455 }
Original file line number Diff line number Diff line change @@ -750,7 +750,7 @@ public void ReturnDescription_StructuredOutputDisabled_IncludedInToolDescription
750750 // When UseStructuredContent is false (default), return description should be appended to tool description
751751 McpServerTool tool = McpServerTool . Create ( ToolWithReturnDescription ) ;
752752
753- Assert . Equal ( "Tool that returns data. Returns : The computed result" , tool . ProtocolTool . Description ) ;
753+ Assert . Equal ( "Tool that returns data.\n Returns : The computed result" , tool . ProtocolTool . Description ) ;
754754 Assert . Null ( tool . ProtocolTool . OutputSchema ) ;
755755 }
756756
@@ -786,7 +786,7 @@ public void ReturnDescription_ExplicitDescriptionOption_SynthesizesWithReturnDes
786786 // the return description should be appended since UseStructuredContent is false
787787 McpServerTool tool = McpServerTool . Create ( ToolWithReturnDescription , new ( ) { Description = "Custom description" } ) ;
788788
789- Assert . Equal ( "Custom description Returns : The computed result" , tool . ProtocolTool . Description ) ;
789+ Assert . Equal ( "Custom description\n Returns : The computed result" , tool . ProtocolTool . Description ) ;
790790 Assert . Null ( tool . ProtocolTool . OutputSchema ) ;
791791 }
792792
You can’t perform that action at this time.
0 commit comments