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

Method list

pkg/middleware/logic_memory_tools.go:131–156  ·  view source on GitHub ↗
(ctx context.Context, namespace string, input map[string]any)

Source from the content-addressed store, hash-verified

129}
130
131func (t *LogicMemoryQueryTool) list(ctx context.Context, namespace string, input map[string]any) (string, error) {
132 // 构建过滤器
133 filters := []logic.Filter{}
134
135 if scope, ok := input["scope"].(string); ok && scope != "" {
136 filters = append(filters, logic.WithScope(logic.MemoryScope(scope)))
137 }
138
139 if minConf, ok := input["min_confidence"].(float64); ok {
140 filters = append(filters, logic.WithMinConfidence(minConf))
141 }
142
143 limit := 10
144 if l, ok := input["limit"].(float64); ok {
145 limit = int(l)
146 }
147 filters = append(filters, logic.WithTopK(limit))
148
149 // 检索 Memory
150 memories, err := t.manager.RetrieveMemories(ctx, namespace, filters...)
151 if err != nil {
152 return "", fmt.Errorf("failed to retrieve memories: %w", err)
153 }
154
155 return t.formatMemoriesAsMarkdown(memories), nil
156}
157
158func (t *LogicMemoryQueryTool) get(ctx context.Context, namespace string, input map[string]any) (string, error) {
159 key, ok := input["key"].(string)

Callers 1

ExecuteMethod · 0.95

Calls 6

WithScopeFunction · 0.92
MemoryScopeTypeAlias · 0.92
WithMinConfidenceFunction · 0.92
WithTopKFunction · 0.92
RetrieveMemoriesMethod · 0.80

Tested by

no test coverage detected