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
1 changed files with 53 additions and 27 deletions
33
src/ModelContextProtocol/Protocol/Messages/JsonRpcRequest.cs
Normal file
33
src/ModelContextProtocol/Protocol/Messages/JsonRpcRequest.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ModelContextProtocol.Protocol.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// A request message in the JSON-RPC protocol.
|
||||
/// </summary>
|
||||
public record JsonRpcRequest : IJsonRpcMessageWithId
|
||||
{
|
||||
/// <summary>
|
||||
/// JSON-RPC protocol version. Always "2.0".
|
||||
/// </summary>
|
||||
[JsonPropertyName("jsonrpc")]
|
||||
public string JsonRpc { get; init; } = "2.0";
|
||||
|
||||
/// <summary>
|
||||
/// Request identifier. Must be a string or number and unique within the session.
|
||||
/// </summary>
|
||||
[JsonPropertyName("id")]
|
||||
public RequestId Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the method to invoke.
|
||||
/// </summary>
|
||||
[JsonPropertyName("method")]
|
||||
public required string Method { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional parameters for the method.
|
||||
/// </summary>
|
||||
[JsonPropertyName("params")]
|
||||
public object? Params { get; init; }
|
||||
}
|
||||
Loading…
Reference in a new issue