Skip to content

Commit 6dec4dd

Browse files
author
Andy Tagg
committed
Set IsError on CallToolResponse to true when result is ErrorContent
1 parent c750f09 commit 6dec4dd

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/ModelContextProtocol/Server/AIFunctionMcpServerTool.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ public override async ValueTask<CallToolResponse> InvokeAsync(
253253
{
254254
AIContent aiContent => new()
255255
{
256-
Content = [aiContent.ToContent()]
256+
Content = [aiContent.ToContent()],
257+
IsError = aiContent is ErrorContent
257258
},
258259

259260
null => new()
@@ -278,7 +279,8 @@ public override async ValueTask<CallToolResponse> InvokeAsync(
278279

279280
IEnumerable<AIContent> contentItems => new()
280281
{
281-
Content = [.. contentItems.Select(static item => item.ToContent())]
282+
Content = [.. contentItems.Select(static item => item.ToContent())],
283+
IsError = contentItems.Any(item => item is ErrorContent)
282284
},
283285

284286
IEnumerable<Content> contents => new()

0 commit comments

Comments
 (0)