Avoid propagating server tool exception message to client (#242)
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
This commit is contained in:
parent
b9c0f269d6
commit
dfafebd8fe
2 changed files with 2 additions and 2 deletions
|
|
@ -270,7 +270,7 @@ internal sealed class AIFunctionMcpServerTool : McpServerTool
|
||||||
return new CallToolResponse()
|
return new CallToolResponse()
|
||||||
{
|
{
|
||||||
IsError = true,
|
IsError = true,
|
||||||
Content = [new() { Text = e.Message, Type = "text" }],
|
Content = [new() { Text = $"An error occurred invoking '{request.Params?.Name}'.", Type = "text" }],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,7 @@ public class McpServerBuilderExtensionsToolsTests : ClientServerTestBase
|
||||||
Assert.True(result.IsError);
|
Assert.True(result.IsError);
|
||||||
Assert.NotNull(result.Content);
|
Assert.NotNull(result.Content);
|
||||||
Assert.NotEmpty(result.Content);
|
Assert.NotEmpty(result.Content);
|
||||||
Assert.Contains("Test error", result.Content[0].Text);
|
Assert.Contains("An error occurred", result.Content[0].Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue