MCPcopy Create free account
hub / github.com/astercloud/aster / GetAnnotations

Function GetAnnotations

pkg/tools/interface.go:73–86  ·  view source on GitHub ↗

GetAnnotations 获取工具的安全注解 如果工具实现了 AnnotatedTool 接口,返回其注解 否则返回默认的中等风险注解

(tool Tool)

Source from the content-addressed store, hash-verified

71// 如果工具实现了 AnnotatedTool 接口,返回其注解
72// 否则返回默认的中等风险注解
73func GetAnnotations(tool Tool) *ToolAnnotations {
74 if at, ok := tool.(AnnotatedTool); ok {
75 return at.Annotations()
76 }
77 // 默认返回中等风险注解(未知工具保守处理)
78 return &ToolAnnotations{
79 ReadOnly: false,
80 Destructive: false,
81 Idempotent: false,
82 OpenWorld: false,
83 RiskLevel: RiskLevelMedium,
84 Category: CategoryCustom,
85 }
86}
87
88// IsToolSafeForAutoApproval 判断工具是否可以自动批准
89func IsToolSafeForAutoApproval(tool Tool) bool {

Callers 4

GetToolRiskLevelFunction · 0.85
TestGetAnnotationsFunction · 0.85
TestAnnotationsNilSafetyFunction · 0.85

Calls 1

AnnotationsMethod · 0.65

Tested by 2

TestGetAnnotationsFunction · 0.68
TestAnnotationsNilSafetyFunction · 0.68