2025-02-23 14:55:35 +00:00
|
|
|
using BotSharp.Abstraction.Agents.Models;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Plugin.MongoStorage.Models;
|
|
|
|
|
|
|
|
|
|
[BsonIgnoreExtraElements(Inherited = true)]
|
2025-04-01 01:59:19 +00:00
|
|
|
public class AgentMcpToolMongoElement
|
2025-02-23 14:55:35 +00:00
|
|
|
{
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
public string ServerId { get; set; }
|
|
|
|
|
public bool Disabled { get; set; }
|
2025-02-25 14:57:22 +00:00
|
|
|
public List<McpFunctionMongoElement> Functions { get; set; } = [];
|
2025-02-23 14:55:35 +00:00
|
|
|
|
2025-04-01 01:59:19 +00:00
|
|
|
public static AgentMcpToolMongoElement ToMongoElement(McpTool tool)
|
2025-02-23 14:55:35 +00:00
|
|
|
{
|
2025-04-01 01:59:19 +00:00
|
|
|
return new AgentMcpToolMongoElement
|
2025-02-23 14:55:35 +00:00
|
|
|
{
|
2025-03-31 22:02:14 +00:00
|
|
|
Name = tool.Name,
|
|
|
|
|
ServerId = tool.ServerId,
|
|
|
|
|
Disabled = tool.Disabled,
|
|
|
|
|
Functions = tool.Functions?.Select(x => new McpFunctionMongoElement(x.Name))?.ToList() ?? [],
|
2025-02-23 14:55:35 +00:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-01 01:59:19 +00:00
|
|
|
public static McpTool ToDomainElement(AgentMcpToolMongoElement tool)
|
2025-02-23 14:55:35 +00:00
|
|
|
{
|
2025-04-01 01:59:19 +00:00
|
|
|
return new McpTool
|
2025-02-23 14:55:35 +00:00
|
|
|
{
|
2025-03-31 22:02:14 +00:00
|
|
|
Name = tool.Name,
|
|
|
|
|
ServerId = tool.ServerId,
|
|
|
|
|
Disabled = tool.Disabled,
|
2025-04-01 01:59:19 +00:00
|
|
|
Functions = tool.Functions?.Select(x => new McpFunction(x.Name))?.ToList() ?? [],
|
2025-02-23 14:55:35 +00:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-31 21:43:42 +00:00
|
|
|
[BsonIgnoreExtraElements(Inherited = true)]
|
2025-02-25 14:57:22 +00:00
|
|
|
public class McpFunctionMongoElement
|
2025-02-23 14:55:35 +00:00
|
|
|
{
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
2025-02-25 14:57:22 +00:00
|
|
|
public McpFunctionMongoElement()
|
2025-02-23 14:55:35 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-25 14:57:22 +00:00
|
|
|
public McpFunctionMongoElement(string name)
|
2025-02-23 14:55:35 +00:00
|
|
|
{
|
|
|
|
|
Name = name;
|
|
|
|
|
}
|
|
|
|
|
}
|