feat: introduce ToolSourceType enum and refactor related code to use it
This commit is contained in:
@@ -93,7 +93,6 @@ func toolSetStaticToolMetadata(toolSet *registry.ToolSet) map[string]registry.To
|
|||||||
item.ToolCode = strings.TrimSpace(item.ToolCode)
|
item.ToolCode = strings.TrimSpace(item.ToolCode)
|
||||||
item.ServerCode = strings.TrimSpace(item.ServerCode)
|
item.ServerCode = strings.TrimSpace(item.ServerCode)
|
||||||
item.ToolName = strings.TrimSpace(item.ToolName)
|
item.ToolName = strings.TrimSpace(item.ToolName)
|
||||||
item.SourceType = strings.TrimSpace(item.SourceType)
|
|
||||||
ret[trimmedName] = item
|
ret[trimmedName] = item
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
impladapter "cs-agent/internal/ai/runtime/internal/impl/adapter"
|
impladapter "cs-agent/internal/ai/runtime/internal/impl/adapter"
|
||||||
|
"cs-agent/internal/pkg/enums"
|
||||||
"cs-agent/internal/pkg/toolx"
|
"cs-agent/internal/pkg/toolx"
|
||||||
|
|
||||||
einotool "github.com/cloudwego/eino/components/tool"
|
einotool "github.com/cloudwego/eino/components/tool"
|
||||||
@@ -18,7 +19,7 @@ type ToolMetadata struct {
|
|||||||
ToolCode string
|
ToolCode string
|
||||||
ServerCode string
|
ServerCode string
|
||||||
ToolName string
|
ToolName string
|
||||||
SourceType string
|
SourceType enums.ToolSourceType
|
||||||
}
|
}
|
||||||
|
|
||||||
type RuntimeTraceHandler struct {
|
type RuntimeTraceHandler struct {
|
||||||
@@ -101,7 +102,7 @@ func (h *RuntimeTraceHandler) WrapInvokableToolCall(_ context.Context, endpoint
|
|||||||
item.ErrorMessage = err.Error()
|
item.ErrorMessage = err.Error()
|
||||||
}
|
}
|
||||||
h.collector.AddToolItem(item)
|
h.collector.AddToolItem(item)
|
||||||
if metadata, ok := h.resolveToolMetadata(item.ToolName); ok && strings.TrimSpace(metadata.SourceType) == toolx.GraphCreateTicketConfirm.ServerCode {
|
if metadata, ok := h.resolveToolMetadata(item.ToolName); ok && metadata.SourceType == enums.ToolSourceTypeGraph {
|
||||||
recommendedAction, riskLevel, ticketDraftReady := parseGraphToolOutcome(item.ToolCode, result)
|
recommendedAction, riskLevel, ticketDraftReady := parseGraphToolOutcome(item.ToolCode, result)
|
||||||
h.collector.AddGraphToolItem(GraphToolTraceItem{
|
h.collector.AddGraphToolItem(GraphToolTraceItem{
|
||||||
ToolCode: item.ToolCode,
|
ToolCode: item.ToolCode,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
impladapter "cs-agent/internal/ai/runtime/internal/impl/adapter"
|
impladapter "cs-agent/internal/ai/runtime/internal/impl/adapter"
|
||||||
runtimetooling "cs-agent/internal/ai/runtime/tooling"
|
runtimetooling "cs-agent/internal/ai/runtime/tooling"
|
||||||
"cs-agent/internal/models"
|
"cs-agent/internal/models"
|
||||||
|
"cs-agent/internal/pkg/enums"
|
||||||
"cs-agent/internal/pkg/toolx"
|
"cs-agent/internal/pkg/toolx"
|
||||||
|
|
||||||
einotool "github.com/cloudwego/eino/components/tool"
|
einotool "github.com/cloudwego/eino/components/tool"
|
||||||
@@ -34,7 +35,7 @@ func (f *ToolFactory) BuildMCPTools(aiAgent *models.AIAgent) ([]runtimetooling.M
|
|||||||
if toolCode == "" {
|
if toolCode == "" {
|
||||||
toolCode = toolx.BuildMCPToolCode(item.ServerCode, item.ToolName)
|
toolCode = toolx.BuildMCPToolCode(item.ServerCode, item.ToolName)
|
||||||
}
|
}
|
||||||
if toolx.ResolveToolSourceType(toolCode) != "mcp" {
|
if toolx.ResolveToolSourceType(toolCode) != enums.ToolSourceTypeMCP {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
serverCode, toolName := toolx.SplitMCPToolCode(toolCode)
|
serverCode, toolName := toolx.SplitMCPToolCode(toolCode)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"cs-agent/internal/ai/runtime/registry"
|
"cs-agent/internal/ai/runtime/registry"
|
||||||
runtimetooling "cs-agent/internal/ai/runtime/tooling"
|
runtimetooling "cs-agent/internal/ai/runtime/tooling"
|
||||||
"cs-agent/internal/models"
|
"cs-agent/internal/models"
|
||||||
|
"cs-agent/internal/pkg/enums"
|
||||||
"cs-agent/internal/pkg/toolx"
|
"cs-agent/internal/pkg/toolx"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ func buildRuntimeTraceToolMetadata(
|
|||||||
ToolCode: strings.TrimSpace(item.ToolCode),
|
ToolCode: strings.TrimSpace(item.ToolCode),
|
||||||
ServerCode: strings.TrimSpace(item.ServerCode),
|
ServerCode: strings.TrimSpace(item.ServerCode),
|
||||||
ToolName: strings.TrimSpace(item.ToolName),
|
ToolName: strings.TrimSpace(item.ToolName),
|
||||||
SourceType: "mcp",
|
SourceType: enums.ToolSourceTypeMCP,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for modelName, metadata := range staticToolMetadata {
|
for modelName, metadata := range staticToolMetadata {
|
||||||
@@ -45,7 +46,6 @@ func buildRuntimeTraceToolMetadata(
|
|||||||
metadata.ToolCode = strings.TrimSpace(metadata.ToolCode)
|
metadata.ToolCode = strings.TrimSpace(metadata.ToolCode)
|
||||||
metadata.ServerCode = strings.TrimSpace(metadata.ServerCode)
|
metadata.ServerCode = strings.TrimSpace(metadata.ServerCode)
|
||||||
metadata.ToolName = strings.TrimSpace(metadata.ToolName)
|
metadata.ToolName = strings.TrimSpace(metadata.ToolName)
|
||||||
metadata.SourceType = strings.TrimSpace(metadata.SourceType)
|
|
||||||
if modelName == "" || metadata.ToolCode == "" {
|
if modelName == "" || metadata.ToolCode == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ func (r *Registry) Resolve(ctx Context) (*ToolSet, error) {
|
|||||||
if strings.TrimSpace(resolvedMetadata.ToolName) == "" {
|
if strings.TrimSpace(resolvedMetadata.ToolName) == "" {
|
||||||
resolvedMetadata.ToolName = toolName
|
resolvedMetadata.ToolName = toolName
|
||||||
}
|
}
|
||||||
if strings.TrimSpace(resolvedMetadata.SourceType) == "" {
|
if resolvedMetadata.SourceType == "" {
|
||||||
resolvedMetadata.SourceType = strings.TrimSpace(spec.SourceType)
|
resolvedMetadata.SourceType = spec.SourceType
|
||||||
}
|
}
|
||||||
ret.StaticToolMetadata[toolName] = ToolMetadata{
|
ret.StaticToolMetadata[toolName] = ToolMetadata{
|
||||||
ToolCode: resolvedMetadata.ToolCode,
|
ToolCode: resolvedMetadata.ToolCode,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package registry
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"cs-agent/internal/models"
|
"cs-agent/internal/models"
|
||||||
|
"cs-agent/internal/pkg/enums"
|
||||||
"cs-agent/internal/pkg/toolx"
|
"cs-agent/internal/pkg/toolx"
|
||||||
|
|
||||||
einotool "github.com/cloudwego/eino/components/tool"
|
einotool "github.com/cloudwego/eino/components/tool"
|
||||||
@@ -19,7 +20,7 @@ type ToolMetadata struct {
|
|||||||
ToolCode string
|
ToolCode string
|
||||||
ServerCode string
|
ServerCode string
|
||||||
ToolName string
|
ToolName string
|
||||||
SourceType string
|
SourceType enums.ToolSourceType
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToolSet 描述当前运行时可直接挂载到 ToolsNode 上的固定工具集合。
|
// ToolSet 描述当前运行时可直接挂载到 ToolsNode 上的固定工具集合。
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package response
|
package response
|
||||||
|
|
||||||
import "cs-agent/internal/ai/mcps"
|
import (
|
||||||
|
"cs-agent/internal/ai/mcps"
|
||||||
|
"cs-agent/internal/pkg/enums"
|
||||||
|
)
|
||||||
|
|
||||||
type MCPConnectionResponse struct {
|
type MCPConnectionResponse struct {
|
||||||
ServerCode string `json:"serverCode"`
|
ServerCode string `json:"serverCode"`
|
||||||
@@ -66,15 +69,15 @@ func BuildMCPToolInfoResponses(items []mcps.ToolInfo) []MCPToolInfoResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MCPToolCatalogResponse struct {
|
type MCPToolCatalogResponse struct {
|
||||||
ToolCode string `json:"toolCode"`
|
ToolCode string `json:"toolCode"`
|
||||||
ServerCode string `json:"serverCode"`
|
ServerCode string `json:"serverCode"`
|
||||||
ToolName string `json:"toolName"`
|
ToolName string `json:"toolName"`
|
||||||
SourceType string `json:"sourceType"`
|
SourceType enums.ToolSourceType `json:"sourceType"`
|
||||||
AutoInjected bool `json:"autoInjected"`
|
AutoInjected bool `json:"autoInjected"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
InputSchema any `json:"inputSchema"`
|
InputSchema any `json:"inputSchema"`
|
||||||
OutputSchema any `json:"outputSchema,omitempty"`
|
OutputSchema any `json:"outputSchema,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MCPToolResultContentResponse struct {
|
type MCPToolResultContentResponse struct {
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package enums
|
||||||
|
|
||||||
|
type ToolSourceType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
ToolSourceTypeMCP ToolSourceType = "mcp"
|
||||||
|
ToolSourceTypeGraph ToolSourceType = "graph"
|
||||||
|
ToolSourceTypeBuiltin ToolSourceType = "builtin"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ToolSourceTypeValues = []ToolSourceType{
|
||||||
|
ToolSourceTypeMCP,
|
||||||
|
ToolSourceTypeGraph,
|
||||||
|
ToolSourceTypeBuiltin,
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsValidToolSourceType(sourceType ToolSourceType) bool {
|
||||||
|
for _, item := range ToolSourceTypeValues {
|
||||||
|
if item == sourceType {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
package toolx
|
package toolx
|
||||||
|
|
||||||
import "strings"
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"cs-agent/internal/pkg/enums"
|
||||||
|
)
|
||||||
|
|
||||||
type ToolSpec struct {
|
type ToolSpec struct {
|
||||||
Code string
|
Code string
|
||||||
@@ -8,7 +12,7 @@ type ToolSpec struct {
|
|||||||
Name string
|
Name string
|
||||||
Title string
|
Title string
|
||||||
Description string
|
Description string
|
||||||
SourceType string
|
SourceType enums.ToolSourceType
|
||||||
AutoInjected bool
|
AutoInjected bool
|
||||||
DirectAccess bool
|
DirectAccess bool
|
||||||
RuntimeStatic bool
|
RuntimeStatic bool
|
||||||
@@ -20,7 +24,7 @@ type ToolMetadata struct {
|
|||||||
ToolCode string
|
ToolCode string
|
||||||
ServerCode string
|
ServerCode string
|
||||||
ToolName string
|
ToolName string
|
||||||
SourceType string
|
SourceType enums.ToolSourceType
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -30,7 +34,7 @@ var (
|
|||||||
Name: "tool_search",
|
Name: "tool_search",
|
||||||
Title: "搜索并调用动态工具",
|
Title: "搜索并调用动态工具",
|
||||||
Description: "用于搜索当前允许使用的 MCP 工具,并在确认目标 toolCode 后动态调用该工具。适合处理长尾工具,不应替代固定内置流程工具。",
|
Description: "用于搜索当前允许使用的 MCP 工具,并在确认目标 toolCode 后动态调用该工具。适合处理长尾工具,不应替代固定内置流程工具。",
|
||||||
SourceType: "builtin",
|
SourceType: enums.ToolSourceTypeBuiltin,
|
||||||
AutoInjected: true,
|
AutoInjected: true,
|
||||||
DirectAccess: true,
|
DirectAccess: true,
|
||||||
Appendix: strings.TrimSpace(`
|
Appendix: strings.TrimSpace(`
|
||||||
@@ -46,7 +50,7 @@ var (
|
|||||||
Name: "skill",
|
Name: "skill",
|
||||||
Title: "加载专项技能说明",
|
Title: "加载专项技能说明",
|
||||||
Description: "用于加载当前命中的专项技能说明文档。仅在本轮已命中 Skill 时可用,适合将专项处理规则按需注入上下文。",
|
Description: "用于加载当前命中的专项技能说明文档。仅在本轮已命中 Skill 时可用,适合将专项处理规则按需注入上下文。",
|
||||||
SourceType: "builtin",
|
SourceType: enums.ToolSourceTypeBuiltin,
|
||||||
AutoInjected: true,
|
AutoInjected: true,
|
||||||
}
|
}
|
||||||
GraphTriageServiceRequest = ToolSpec{
|
GraphTriageServiceRequest = ToolSpec{
|
||||||
@@ -55,7 +59,7 @@ var (
|
|||||||
Name: "triage_service_request",
|
Name: "triage_service_request",
|
||||||
Title: "升级分流判断",
|
Title: "升级分流判断",
|
||||||
Description: "Graph Tool。用于综合分析当前对话,判断应继续解答、整理工单草稿还是转人工,并在需要建单时一并整理工单草稿。",
|
Description: "Graph Tool。用于综合分析当前对话,判断应继续解答、整理工单草稿还是转人工,并在需要建单时一并整理工单草稿。",
|
||||||
SourceType: "graph",
|
SourceType: enums.ToolSourceTypeGraph,
|
||||||
RuntimeStatic: true,
|
RuntimeStatic: true,
|
||||||
Appendix: strings.TrimSpace(`
|
Appendix: strings.TrimSpace(`
|
||||||
当你需要判断“继续解答 / 建单 / 转人工”这类复杂升级路径时,优先先调用 triage_service_request 这个 Graph Tool,并遵守以下规则:
|
当你需要判断“继续解答 / 建单 / 转人工”这类复杂升级路径时,优先先调用 triage_service_request 这个 Graph Tool,并遵守以下规则:
|
||||||
@@ -72,7 +76,7 @@ var (
|
|||||||
Name: "analyze_conversation",
|
Name: "analyze_conversation",
|
||||||
Title: "分析对话风险与摘要",
|
Title: "分析对话风险与摘要",
|
||||||
Description: "Graph Tool。用于整理当前对话摘要、识别风险信号,并给出继续解答、建单或转人工的建议。",
|
Description: "Graph Tool。用于整理当前对话摘要、识别风险信号,并给出继续解答、建单或转人工的建议。",
|
||||||
SourceType: "graph",
|
SourceType: enums.ToolSourceTypeGraph,
|
||||||
RuntimeStatic: true,
|
RuntimeStatic: true,
|
||||||
Appendix: strings.TrimSpace(`
|
Appendix: strings.TrimSpace(`
|
||||||
当对话可能涉及投诉升级、退款赔偿、明显负面情绪、是否要建单、是否要转人工等复杂判断时,优先调用 analyze_conversation 这个 Graph Tool,并遵守以下规则:
|
当对话可能涉及投诉升级、退款赔偿、明显负面情绪、是否要建单、是否要转人工等复杂判断时,优先调用 analyze_conversation 这个 Graph Tool,并遵守以下规则:
|
||||||
@@ -88,7 +92,7 @@ var (
|
|||||||
Name: "prepare_ticket_draft",
|
Name: "prepare_ticket_draft",
|
||||||
Title: "整理工单草稿",
|
Title: "整理工单草稿",
|
||||||
Description: "Graph Tool。用于根据当前会话和已收集信息整理工单草稿,输出建议标题、描述、缺失字段和追问建议。",
|
Description: "Graph Tool。用于根据当前会话和已收集信息整理工单草稿,输出建议标题、描述、缺失字段和追问建议。",
|
||||||
SourceType: "graph",
|
SourceType: enums.ToolSourceTypeGraph,
|
||||||
RuntimeStatic: true,
|
RuntimeStatic: true,
|
||||||
Appendix: strings.TrimSpace(`
|
Appendix: strings.TrimSpace(`
|
||||||
当用户已经表达了建单、投诉、报障、售后处理等诉求,但工单标题、描述或问题整理还比较散乱时,优先调用 prepare_ticket_draft 这个 Graph Tool,并遵守以下规则:
|
当用户已经表达了建单、投诉、报障、售后处理等诉求,但工单标题、描述或问题整理还比较散乱时,优先调用 prepare_ticket_draft 这个 Graph Tool,并遵守以下规则:
|
||||||
@@ -104,7 +108,7 @@ var (
|
|||||||
Name: "create_ticket_with_confirmation",
|
Name: "create_ticket_with_confirmation",
|
||||||
Title: "创建工单确认流程",
|
Title: "创建工单确认流程",
|
||||||
Description: "Graph Tool。用于封装建单参数整理、用户确认、真正建单和结果返回的确定性流程。",
|
Description: "Graph Tool。用于封装建单参数整理、用户确认、真正建单和结果返回的确定性流程。",
|
||||||
SourceType: "graph",
|
SourceType: enums.ToolSourceTypeGraph,
|
||||||
DirectAccess: true,
|
DirectAccess: true,
|
||||||
RuntimeStatic: true,
|
RuntimeStatic: true,
|
||||||
Aliases: []string{"builtin/create_ticket_with_confirmation"},
|
Aliases: []string{"builtin/create_ticket_with_confirmation"},
|
||||||
@@ -123,7 +127,7 @@ var (
|
|||||||
Name: "handoff_to_human",
|
Name: "handoff_to_human",
|
||||||
Title: "转人工确认流程",
|
Title: "转人工确认流程",
|
||||||
Description: "Graph Tool。用于封装转人工原因整理、用户确认、真正转人工和结果返回的确定性流程。",
|
Description: "Graph Tool。用于封装转人工原因整理、用户确认、真正转人工和结果返回的确定性流程。",
|
||||||
SourceType: "graph",
|
SourceType: enums.ToolSourceTypeGraph,
|
||||||
DirectAccess: true,
|
DirectAccess: true,
|
||||||
RuntimeStatic: true,
|
RuntimeStatic: true,
|
||||||
Appendix: strings.TrimSpace(`
|
Appendix: strings.TrimSpace(`
|
||||||
@@ -229,18 +233,18 @@ func GetRegisteredToolIdentity(toolCode string) (serverCode, toolName string, ok
|
|||||||
return spec.ServerCode, spec.Name, true
|
return spec.ServerCode, spec.Name, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func ResolveToolSourceType(toolCode string) string {
|
func ResolveToolSourceType(toolCode string) enums.ToolSourceType {
|
||||||
if spec, ok := GetRegisteredToolSpec(toolCode); ok {
|
if spec, ok := GetRegisteredToolSpec(toolCode); ok {
|
||||||
return spec.SourceType
|
return spec.SourceType
|
||||||
}
|
}
|
||||||
toolCode = strings.TrimSpace(toolCode)
|
toolCode = strings.TrimSpace(toolCode)
|
||||||
switch {
|
switch {
|
||||||
case strings.HasPrefix(toolCode, "graph/"):
|
case strings.HasPrefix(toolCode, "graph/"):
|
||||||
return "graph"
|
return enums.ToolSourceTypeGraph
|
||||||
case strings.HasPrefix(toolCode, "builtin/"):
|
case strings.HasPrefix(toolCode, "builtin/"):
|
||||||
return "builtin"
|
return enums.ToolSourceTypeBuiltin
|
||||||
default:
|
default:
|
||||||
return "mcp"
|
return enums.ToolSourceTypeMCP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,7 +313,7 @@ func BuildToolAppendicesForCodes(hasDynamicMCPTools bool, toolCodes []string) []
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func BuildToolMetadata(toolCode string) (serverCode, toolName, sourceType string, ok bool) {
|
func BuildToolMetadata(toolCode string) (serverCode, toolName string, sourceType enums.ToolSourceType, ok bool) {
|
||||||
spec, ok := GetRegisteredToolSpec(toolCode)
|
spec, ok := GetRegisteredToolSpec(toolCode)
|
||||||
if !ok {
|
if !ok {
|
||||||
return "", "", ResolveToolSourceType(toolCode), false
|
return "", "", ResolveToolSourceType(toolCode), false
|
||||||
@@ -331,7 +335,7 @@ func ResolveToolMetadata(toolCode string, fallbackName string) ToolMetadata {
|
|||||||
ToolCode: toolCode,
|
ToolCode: toolCode,
|
||||||
ServerCode: strings.TrimSpace(serverCode),
|
ServerCode: strings.TrimSpace(serverCode),
|
||||||
ToolName: strings.TrimSpace(toolName),
|
ToolName: strings.TrimSpace(toolName),
|
||||||
SourceType: strings.TrimSpace(sourceType),
|
SourceType: sourceType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
"cs-agent/internal/ai/mcps"
|
"cs-agent/internal/ai/mcps"
|
||||||
"cs-agent/internal/pkg/config"
|
"cs-agent/internal/pkg/config"
|
||||||
|
"cs-agent/internal/pkg/enums"
|
||||||
"cs-agent/internal/pkg/errorsx"
|
"cs-agent/internal/pkg/errorsx"
|
||||||
"cs-agent/internal/pkg/toolx"
|
"cs-agent/internal/pkg/toolx"
|
||||||
)
|
)
|
||||||
@@ -23,7 +24,7 @@ type MCPToolCatalogItem struct {
|
|||||||
ToolCode string
|
ToolCode string
|
||||||
ServerCode string
|
ServerCode string
|
||||||
ToolName string
|
ToolName string
|
||||||
SourceType string
|
SourceType enums.ToolSourceType
|
||||||
AutoInjected bool
|
AutoInjected bool
|
||||||
Title string
|
Title string
|
||||||
Description string
|
Description string
|
||||||
@@ -69,7 +70,7 @@ func (s *toolCatalogService) ListMCPTools(ctx context.Context) ([]MCPToolCatalog
|
|||||||
ToolCode: toolx.BuildMCPToolCode(serverCode, item.Name),
|
ToolCode: toolx.BuildMCPToolCode(serverCode, item.Name),
|
||||||
ServerCode: serverCode,
|
ServerCode: serverCode,
|
||||||
ToolName: strings.TrimSpace(item.Name),
|
ToolName: strings.TrimSpace(item.Name),
|
||||||
SourceType: "mcp",
|
SourceType: enums.ToolSourceTypeMCP,
|
||||||
AutoInjected: false,
|
AutoInjected: false,
|
||||||
Title: strings.TrimSpace(item.Title),
|
Title: strings.TrimSpace(item.Title),
|
||||||
Description: strings.TrimSpace(item.Description),
|
Description: strings.TrimSpace(item.Description),
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import {
|
|||||||
type CreateAIAgentPayload,
|
type CreateAIAgentPayload,
|
||||||
type KnowledgeBase,
|
type KnowledgeBase,
|
||||||
type MCPToolCatalogItem,
|
type MCPToolCatalogItem,
|
||||||
|
type MCPToolSourceType,
|
||||||
type SkillDefinition,
|
type SkillDefinition,
|
||||||
fetchAIAgent,
|
fetchAIAgent,
|
||||||
fetchAIConfigsAll,
|
fetchAIConfigsAll,
|
||||||
@@ -63,7 +64,7 @@ type DirectToolOption = {
|
|||||||
value: string;
|
value: string;
|
||||||
label: string;
|
label: string;
|
||||||
meta: DirectToolItem;
|
meta: DirectToolItem;
|
||||||
sourceType: string;
|
sourceType: MCPToolSourceType;
|
||||||
autoInjected: boolean;
|
autoInjected: boolean;
|
||||||
groupLabel: string;
|
groupLabel: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -359,11 +359,13 @@ export type MCPToolInfo = {
|
|||||||
outputSchema?: unknown
|
outputSchema?: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type MCPToolSourceType = "mcp" | "graph" | "builtin"
|
||||||
|
|
||||||
export type MCPToolCatalogItem = {
|
export type MCPToolCatalogItem = {
|
||||||
toolCode: string
|
toolCode: string
|
||||||
serverCode: string
|
serverCode: string
|
||||||
toolName: string
|
toolName: string
|
||||||
sourceType: string
|
sourceType: MCPToolSourceType
|
||||||
autoInjected: boolean
|
autoInjected: boolean
|
||||||
title: string
|
title: string
|
||||||
description: string
|
description: string
|
||||||
|
|||||||
Reference in New Issue
Block a user