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

Method Execute

examples/memory-advanced/main.go:166–190  ·  view source on GitHub ↗
(ctx context.Context, input map[string]any, tc *tools.ToolContext)

Source from the content-addressed store, hash-verified

164}
165
166func (t *resourceNoteTool) Execute(ctx context.Context, input map[string]any, tc *tools.ToolContext) (any, error) {
167 note, _ := input["note"].(string)
168 if note == "" {
169 return nil, errors.New("note is required")
170 }
171
172 scope := memory.Scope{
173 UserID: t.userID,
174 ProjectID: t.projectID,
175 ResourceType: t.resourceType,
176 ResourceID: t.resourceID,
177 Shared: t.shared,
178 }
179 ns := scope.Namespace()
180
181 payload := map[string]any{
182 "file": "notes.md",
183 "namespace": ns,
184 "mode": "append",
185 "title": "Resource note",
186 "content": note,
187 }
188
189 return t.memoryWrite.Execute(ctx, payload, tc)
190}
191
192func (t *resourceNoteTool) Prompt() string {
193 return `Use this tool to write notes about a specific resource (article, novel, song, PPT, etc.). The tool will choose a stable namespace and filename; you only need to focus on the note content.`

Callers 1

mainFunction · 0.95

Calls 2

NamespaceMethod · 0.95
ExecuteMethod · 0.65

Tested by

no test coverage detected