Skip to content

Commit 803c882

Browse files
author
Andy Tagg
committed
Updated the IsError determination for a list of AIContent to require that all items in contentItems are instances of ErrorContent and that the collection is not empty
1 parent 6dec4dd commit 803c882

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ModelContextProtocol/Server/AIFunctionMcpServerTool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public override async ValueTask<CallToolResponse> InvokeAsync(
280280
IEnumerable<AIContent> contentItems => new()
281281
{
282282
Content = [.. contentItems.Select(static item => item.ToContent())],
283-
IsError = contentItems.Any(item => item is ErrorContent)
283+
IsError = contentItems.All(item => item is ErrorContent) && contentItems.Any()
284284
},
285285

286286
IEnumerable<Content> contents => new()

0 commit comments

Comments
 (0)