Add files via upload

This commit is contained in:
公明
2026-02-07 00:04:59 +08:00
committed by GitHub
parent 2b6b678439
commit 27b16e0d54
2 changed files with 17 additions and 17 deletions
+12 -12
View File
@@ -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
}
+5 -5
View File
@@ -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