Fix some issues with Native AOT (#130)
* Fix some issues with Native AOT - An anonymous type was being used in McpClient for the initialize result message. Switched to use the type for that purpose that already existed. - A bunch of the request params / result types were not in the source context or referenced from types that were or from custom converters. Added all the request/result types to the context. - Improved the warning message for WithTools.
This commit is contained in:
parent
9330774795
commit
2c1672cc1a
2 changed files with 53 additions and 27 deletions
|
|
@ -1,5 +1,4 @@
|
|||
using Microsoft.Extensions.AI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ModelContextProtocol.Protocol.Types;
|
||||
using ModelContextProtocol.Server;
|
||||
using Moq;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Text.Json;
|
|||
using ModelContextProtocol.Protocol.Messages;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using ModelContextProtocol.Protocol.Types;
|
||||
|
||||
namespace ModelContextProtocol.Tests.Utils;
|
||||
|
||||
|
|
@ -288,19 +289,14 @@ public sealed class InMemoryTestSseServer : IAsyncDisposable
|
|||
var jsonRpcResponse = new JsonRpcResponse()
|
||||
{
|
||||
Id = jsonRpcRequest.Id,
|
||||
Result = new
|
||||
Result = new InitializeResult()
|
||||
{
|
||||
protocolVersion = "2024-11-05",
|
||||
capabilities = new
|
||||
ProtocolVersion = "2024-11-05",
|
||||
Capabilities = new(),
|
||||
ServerInfo = new()
|
||||
{
|
||||
experimental = (object?)null,
|
||||
roots = (object?)null,
|
||||
sampling = (object?)null
|
||||
},
|
||||
serverInfo = new
|
||||
{
|
||||
name = "ExampleServer",
|
||||
version = "1.0.0"
|
||||
Name = "ExampleServer",
|
||||
Version = "1.0.0"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue