Change type of Tool.InputSchema to be JsonElement (#4)
* Change type of Tool.InputSchema to be JsonElement * Add schema validation in the InputSchema property setter. * Simplify AIFunction tool adapter. --------- Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
This commit is contained in:
parent
d23e065945
commit
3de19d38e4
1 changed files with 175 additions and 128 deletions
|
|
@ -16,9 +16,7 @@ public static class McpToolExtensions
|
|||
List<Anthropic.SDK.Common.Tool> result = [];
|
||||
foreach (var tool in tools)
|
||||
{
|
||||
var function = tool.InputSchema == null
|
||||
? new Function(tool.Name, tool.Description)
|
||||
: new Function(tool.Name, tool.Description, JsonSerializer.Serialize(tool.InputSchema));
|
||||
var function = new Function(tool.Name, tool.Description, JsonSerializer.SerializeToNode(tool.InputSchema));
|
||||
result.Add(function);
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Reference in a new issue