feat: introduce ToolSourceType enum and refactor related code to use it

This commit is contained in:
mlogclub
2026-04-14 15:05:38 +08:00
parent 0ea493e536
commit 8d560bb6bd
12 changed files with 76 additions and 39 deletions
+3 -2
View File
@@ -7,6 +7,7 @@ import (
"cs-agent/internal/ai/mcps"
"cs-agent/internal/pkg/config"
"cs-agent/internal/pkg/enums"
"cs-agent/internal/pkg/errorsx"
"cs-agent/internal/pkg/toolx"
)
@@ -23,7 +24,7 @@ type MCPToolCatalogItem struct {
ToolCode string
ServerCode string
ToolName string
SourceType string
SourceType enums.ToolSourceType
AutoInjected bool
Title string
Description string
@@ -69,7 +70,7 @@ func (s *toolCatalogService) ListMCPTools(ctx context.Context) ([]MCPToolCatalog
ToolCode: toolx.BuildMCPToolCode(serverCode, item.Name),
ServerCode: serverCode,
ToolName: strings.TrimSpace(item.Name),
SourceType: "mcp",
SourceType: enums.ToolSourceTypeMCP,
AutoInjected: false,
Title: strings.TrimSpace(item.Title),
Description: strings.TrimSpace(item.Description),