Make CallToolResult.IsError optional (#573)

Match the spec, and avoid sending the property in the success case.
This commit is contained in:
Stephen Toub 2025-06-30 11:35:07 -04:00 • committed by GitHub
commit ab51400ba0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -91,7 +91,7 @@ public partial class ClientIntegrationTests : LoggedTest, IClassFixture<ClientIn
// assert
Assert.NotNull(result);
Assert.False(result.IsError);
Assert.Null(result.IsError);
var textContent = Assert.Single(result.Content.OfType<TextContentBlock>());
Assert.Equal("Echo: Hello MCP!", textContent.Text);
}
@ -107,7 +107,7 @@ public partial class ClientIntegrationTests : LoggedTest, IClassFixture<ClientIn
// assert
Assert.NotNull(result);
Assert.False(result.IsError);
Assert.Null(result.IsError);
var textContent = Assert.Single(result.Content.OfType<TextContentBlock>());
Assert.Empty(textContent.Text);
}
@ -485,7 +485,7 @@ public partial class ClientIntegrationTests : LoggedTest, IClassFixture<ClientIn
// assert
Assert.NotNull(result);
Assert.False(result.IsError);
Assert.Null(result.IsError);
Assert.Single(result.Content, c => c.Type == "text");
await client.DisposeAsync();