add all requirements for implementing XAiMcpClient ...

This commit is contained in:
2026-11-06 19:09:19 +03:30
parent fafc9836a2
commit e0d8c9ce98
8 changed files with 672 additions and 3 deletions
+34
View File
@@ -1,6 +1,10 @@
using xAiModels.Models;
using xCommons.Extensions;
using xAiService.Services;
using xExceptions.Constants;
using xIdentityModels.Models;
using Microsoft.Extensions.AI;
using System.Collections.Generic;
namespace xAiService.Extensions
{
@@ -40,5 +44,35 @@ namespace xAiService.Extensions
invalidException.Throw();
}
}
/// <summary>
/// Converts To AITools ...
/// </summary>
/// <param name="source"></param>
/// <param name="client"></param>
/// <returns></returns>
public static IList<AITool> ToAITools(
this IList<XAiMcpToolDefinition> source,
XAiMcpClient client
)
{
//
if (client.IsNullOrDefault())
{
XException.InvalidArgs.Throw();
}
//
var result = new List<AITool>();
//
foreach (var tool in source)
{
result.Add(new XAiMcpAIFunction(client, tool));
}
//
return result;
}
}
}