From 485757c5f388b700bdce390c85ba328fd2a1b735 Mon Sep 17 00:00:00 2001 From: geffzhang Date: Wed, 26 Feb 2025 06:56:46 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=20remove=20mcptooltemplate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BotSharp.Abstraction/Agents/Models/MCPTool.cs | 10 +++------- .../BotSharp.MCP/Functions/McpToolFunction.cs | 1 - .../Models/AgentMCPToolMongoElement.cs | 4 ---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/Agents/Models/MCPTool.cs b/src/Infrastructure/BotSharp.Abstraction/Agents/Models/MCPTool.cs index fc8fbb62..a555a7e5 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Agents/Models/MCPTool.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Agents/Models/MCPTool.cs @@ -2,8 +2,6 @@ namespace BotSharp.Abstraction.Agents.Models; public class MCPTool { - public string Name { get; set; } - public string ServerId { get; set; } public bool Disabled { get; set; } @@ -16,16 +14,14 @@ public class MCPTool } public MCPTool( - string name, IEnumerable? functions = null) { - Name = name; Functions = functions ?? []; } public override string ToString() { - return Name; + return ServerId; } } @@ -34,8 +30,8 @@ public class MCPFunction { public string Name { get; set; } - public MCPFunction() + public MCPFunction(string name) { - + this.Name = name; } } diff --git a/src/Infrastructure/BotSharp.MCP/Functions/McpToolFunction.cs b/src/Infrastructure/BotSharp.MCP/Functions/McpToolFunction.cs index 5df8fb07..a89cc10c 100644 --- a/src/Infrastructure/BotSharp.MCP/Functions/McpToolFunction.cs +++ b/src/Infrastructure/BotSharp.MCP/Functions/McpToolFunction.cs @@ -47,7 +47,6 @@ public class McpToolFunction : IFunctionCallback if (string.IsNullOrEmpty(json)) return []; - // 使用JsonDocument解析JSON字符串 using JsonDocument doc = JsonDocument.Parse(json); JsonElement root = doc.RootElement; return JsonElementToDictionary(root); diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentMCPToolMongoElement.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentMCPToolMongoElement.cs index dae4c665..ecad71f3 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentMCPToolMongoElement.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentMCPToolMongoElement.cs @@ -22,10 +22,8 @@ public class AgentMCPToolMongoElement { return new AgentMCPToolMongoElement { - Name = utility.Name, Disabled = utility.Disabled, Functions = utility.Functions?.Select(x => new McpFunctionMongoElement(x.Name))?.ToList() ?? [], - Templates = utility.Templates?.Select(x => new McpTemplateMongoElement(x.Name))?.ToList() ?? [] }; } @@ -33,10 +31,8 @@ public class AgentMCPToolMongoElement { return new MCPTool { - Name = utility.Name, Disabled = utility.Disabled, Functions = utility.Functions?.Select(x => new MCPFunction(x.Name))?.ToList() ?? [], - Templates = utility.Templates?.Select(x => new ACPTemplate(x.Name))?.ToList() ?? [] }; } }