BotSharp/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentMCPToolMongoElement.cs

47 lines
1.2 KiB
C#
Raw Normal View History

2025-02-23 14:55:35 +00:00
using BotSharp.Abstraction.Agents.Models;
namespace BotSharp.Plugin.MongoStorage.Models;
[BsonIgnoreExtraElements(Inherited = true)]
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; }
public List<McpFunctionMongoElement> Functions { get; set; } = [];
2025-02-23 14:55:35 +00:00
public static AgentMCPToolMongoElement ToMongoElement(MCPTool utility)
2025-02-23 14:55:35 +00:00
{
return new AgentMCPToolMongoElement
2025-02-23 14:55:35 +00:00
{
Disabled = utility.Disabled,
Functions = utility.Functions?.Select(x => new McpFunctionMongoElement(x.Name))?.ToList() ?? [],
2025-02-23 14:55:35 +00:00
};
}
public static MCPTool ToDomainElement(AgentMCPToolMongoElement utility)
2025-02-23 14:55:35 +00:00
{
return new MCPTool
2025-02-23 14:55:35 +00:00
{
Disabled = utility.Disabled,
Functions = utility.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)]
public class McpFunctionMongoElement
2025-02-23 14:55:35 +00:00
{
public string Name { get; set; }
public McpFunctionMongoElement()
2025-02-23 14:55:35 +00:00
{
}
public McpFunctionMongoElement(string name)
2025-02-23 14:55:35 +00:00
{
Name = name;
}
}