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:
parent
ea296f5dc4
commit
e190844218
4 changed files with 71 additions and 0 deletions
|
|
@ -130,6 +130,7 @@ internal sealed class AIFunctionMcpServerPrompt : McpServerPrompt
|
|||
return null;
|
||||
}
|
||||
},
|
||||
JsonSchemaCreateOptions = options?.SchemaCreateOptions,
|
||||
};
|
||||
|
||||
/// <summary>Creates an <see cref="McpServerPrompt"/> that wraps the specified <see cref="AIFunction"/>.</summary>
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ internal sealed class AIFunctionMcpServerTool : McpServerTool
|
|||
return null;
|
||||
}
|
||||
},
|
||||
JsonSchemaCreateOptions = options?.SchemaCreateOptions,
|
||||
};
|
||||
|
||||
/// <summary>Creates an <see cref="McpServerTool"/> that wraps the specified <see cref="AIFunction"/>.</summary>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using Microsoft.Extensions.AI;
|
||||
using ModelContextProtocol.Utils.Json;
|
||||
using System.ComponentModel;
|
||||
using System.Text.Json;
|
||||
|
|
@ -55,6 +56,14 @@ public sealed class McpServerPromptCreateOptions
|
|||
/// </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="McpServerPromptCreateOptions"/> instance.
|
||||
/// </summary>
|
||||
|
|
@ -65,5 +74,6 @@ public sealed class McpServerPromptCreateOptions
|
|||
Name = Name,
|
||||
Description = Description,
|
||||
SerializerOptions = SerializerOptions,
|
||||
SchemaCreateOptions = SchemaCreateOptions,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue