增加 WebSearch 返回结果,加入今天的日期

This commit is contained in:
史悦 2025-05-14 16:15:09 +08:00
parent ef00e87e86
commit 5a72eb7c64

View File

@ -8,9 +8,9 @@ namespace GLMSearch.Tools
[McpServerToolType] [McpServerToolType]
public static class GLMWebSearch public static class GLMWebSearch
{ {
[McpServerTool(Name = "WebSearch"), Description("通过关键字进行Web搜索")] [McpServerTool(Name = "WebSearch"), Description("通过关键字进行Web搜索。返回结果中包含当前的日期,如有必要,请注意甄别搜索结果的时效性。")]
public static string WebSearch( public static string WebSearch(
[Description("搜索关键字")] string keyword, [Description("搜索关键字,注意要输入检索的关键字而不是问题本身,要解决一个问题可能需要多次搜索,直接搜索问题本身可能会限定搜索范围。")] string keyword,
[Description("搜索引擎,请务必从[search_std,search_pro,search_pro_quark]search_pro_quark")] string search_engine = "search_pro_quark") [Description("搜索引擎,请务必从[search_std,search_pro,search_pro_quark]search_pro_quark")] string search_engine = "search_pro_quark")
{ {
Console.WriteLine($"接收到搜索任务:{keyword}"); Console.WriteLine($"接收到搜索任务:{keyword}");
@ -44,7 +44,8 @@ namespace GLMSearch.Tools
new JProperty("content", result["content"]), new JProperty("content", result["content"]),
new JProperty("title", result["title"]), new JProperty("title", result["title"]),
new JProperty("media", result["media"]), new JProperty("media", result["media"]),
new JProperty("link", result["link"]) new JProperty("link", result["link"]),
new JProperty("today", DateTime.Now.ToString("yyyy-MM-dd"))
); );
}).ToList(); }).ToList();