From 544bc8cd406233b2e6eebed9f6df0b4b7b90d2d9 Mon Sep 17 00:00:00 2001 From: PeterZhong Date: Sun, 8 Jun 2025 16:13:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3MCP=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=87=BA=E9=94=99=E5=BD=B1=E5=93=8D=E4=B8=BB=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/tool/ArcGisPro.cs | 2 +- host/Gateway.cs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/tool/ArcGisPro.cs b/client/tool/ArcGisPro.cs index dbc5ac1..6c1adcf 100644 --- a/client/tool/ArcGisPro.cs +++ b/client/tool/ArcGisPro.cs @@ -24,7 +24,7 @@ public class ArcGisPro [McpServerTool, Description("可以通过调用ArcGIS Pro的地理处理工具实现一些数据处理功能,传入参数必须严格遵循ArcGIS Pro调用工具的标准调用名和参数要求知识库。")] public static async Task ArcGisProTool(string toolName, List toolParams) { - IGPResult results = await Geoprocessing.ExecuteToolAsync(toolName, toolParams); + IGPResult results = await Geoprocessing.ExecuteToolAsync(toolName, toolParams,null,null,null,GPExecuteToolFlags.InheritGPOptions|GPExecuteToolFlags.GPThread); JsonRpcResultEntity jsonRpcResultEntity; if (results.IsFailed) { diff --git a/host/Gateway.cs b/host/Gateway.cs index 57d9845..8ce17fb 100644 --- a/host/Gateway.cs +++ b/host/Gateway.cs @@ -636,7 +636,8 @@ public class Gateway private static async Task GetToolInfos(McpServerList mcpServerList) { StringBuilder toolInfos = new StringBuilder(); - int i = 0; + int i = 0; + List failedMcp = new List(); foreach (McpServer mcpServer in mcpServerList.GetAllServers()) { i++; @@ -715,7 +716,7 @@ public class Gateway }catch (Exception e) { log.Error(e.Message); - MessageBox.Show(e.Message, $"第{i}MCP读取错误"); + failedMcp.Add(i); } } @@ -731,9 +732,9 @@ public class Gateway catch (Exception e) { log.Error(e.Message); - MessageBox.Show(e.Message, $"{userPrompt.Name}提示词读取错误"); } } + MessageBox.Show($"读取失败的MCP序号:{JsonConvert.SerializeObject(failedMcp)}","MCP读取错误"); return toolInfos.ToString(); }