From 27b16e0d546e96c7fdfc9cbe0f6b7fd523858102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AC=E6=98=8E?= <83812544+Ed1s0nZ@users.noreply.github.com> Date: Sat, 7 Feb 2026 00:04:59 +0800 Subject: [PATCH] Add files via upload --- internal/handler/config.go | 24 ++++++++++++------------ internal/security/executor.go | 10 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/handler/config.go b/internal/handler/config.go index 78e65577..eeeb22c4 100644 --- a/internal/handler/config.go +++ b/internal/handler/config.go @@ -178,11 +178,11 @@ func (h *ConfigHandler) GetConfig(c *gin.Context) { Enabled: tool.Enabled, IsExternal: false, }) - // 如果没有简短描述,使用详细描述的前100个字符 + // 如果没有简短描述,使用详细描述的前10000个字符 if tools[len(tools)-1].Description == "" { desc := tool.Description - if len(desc) > 100 { - desc = desc[:100] + "..." + if len(desc) > 10000 { + desc = desc[:10000] + "..." } tools[len(tools)-1].Description = desc } @@ -201,8 +201,8 @@ func (h *ConfigHandler) GetConfig(c *gin.Context) { if description == "" { description = mcpTool.Description } - if len(description) > 100 { - description = description[:100] + "..." + if len(description) > 10000 { + description = description[:10000] + "..." } tools = append(tools, ToolConfigInfo{ Name: mcpTool.Name, @@ -295,11 +295,11 @@ func (h *ConfigHandler) GetTools(c *gin.Context) { Enabled: tool.Enabled, IsExternal: false, } - // 如果没有简短描述,使用详细描述的前100个字符 + // 如果没有简短描述,使用详细描述的前10000个字符 if toolInfo.Description == "" { desc := tool.Description - if len(desc) > 100 { - desc = desc[:100] + "..." + if len(desc) > 10000 { + desc = desc[:10000] + "..." } toolInfo.Description = desc } @@ -354,8 +354,8 @@ func (h *ConfigHandler) GetTools(c *gin.Context) { if description == "" { description = mcpTool.Description } - if len(description) > 100 { - description = description[:100] + "..." + if len(description) > 10000 { + description = description[:10000] + "..." } toolInfo := ToolConfigInfo{ @@ -1255,8 +1255,8 @@ func (h *ConfigHandler) formatToolDescription(shortDesc, fullDesc string) string if description == "" { description = fullDesc } - if len(description) > 100 { - description = description[:100] + "..." + if len(description) > 10000 { + description = description[:10000] + "..." } return description } diff --git a/internal/security/executor.go b/internal/security/executor.go index 5cce1fc7..96de9620 100644 --- a/internal/security/executor.go +++ b/internal/security/executor.go @@ -224,17 +224,17 @@ func (e *Executor) RegisterTools(mcpServer *mcp.Server) { toolName := toolConfig.Name toolConfigCopy := toolConfig - // 使用简短描述(如果存在),否则使用详细描述的前100个字符 + // 使用简短描述(如果存在),否则使用详细描述的前10000个字符 shortDesc := toolConfigCopy.ShortDescription if shortDesc == "" { - // 如果没有简短描述,从详细描述中提取第一行或前100个字符 + // 如果没有简短描述,从详细描述中提取第一行或前10000个字符 desc := toolConfigCopy.Description - if len(desc) > 100 { + if len(desc) > 10000 { // 尝试找到第一个换行符 - if idx := strings.Index(desc, "\n"); idx > 0 && idx < 100 { + if idx := strings.Index(desc, "\n"); idx > 0 && idx < 10000 { shortDesc = strings.TrimSpace(desc[:idx]) } else { - shortDesc = desc[:100] + "..." + shortDesc = desc[:10000] + "..." } } else { shortDesc = desc