Add SchemaCreateOptions in McpServerToolCreateOptions/McpServerPromptCreateOptions (#354)

* Add SchemaCreateOptions in McpServerToolCreateOptions

* Use TransformSchemaNode for SchemaCreateOptions testing

* Add SchemaCreateOptions in McpServerPromptCreateOptions also
This commit is contained in:
1357310795 2025-04-25 21:36:00 +08:00 • committed by GitHub
commit e190844218
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,3 +1,4 @@
using Microsoft.Extensions.AI;
using ModelContextProtocol.Utils.Json;
using System.ComponentModel;
using System.Text.Json;
@ -132,6 +133,14 @@ public sealed class McpServerToolCreateOptions
/// </remarks>
public JsonSerializerOptions? SerializerOptions { get; set; }
/// <summary>
/// Gets or sets the JSON schema options when creating <see cref="AIFunction"/> from a method.
/// </summary>
/// <remarks>
/// Defaults to <see cref="AIJsonSchemaCreateOptions.Default"/> if left unspecified.
/// </remarks>
public AIJsonSchemaCreateOptions? SchemaCreateOptions { get; set; }
/// <summary>
/// Creates a shallow clone of the current <see cref="McpServerToolCreateOptions"/> instance.
/// </summary>
@ -147,5 +156,6 @@ public sealed class McpServerToolCreateOptions
OpenWorld = OpenWorld,
ReadOnly = ReadOnly,
SerializerOptions = SerializerOptions,
SchemaCreateOptions = SchemaCreateOptions,
};
}