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

Method Execute

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

Source from the content-addressed store, hash-verified

102}
103
104func (t *projectFactTool) Execute(ctx context.Context, input map[string]any, tc *tools.ToolContext) (any, error) {
105 fact, _ := input["fact"].(string)
106 if fact == "" {
107 return nil, errors.New("fact is required")
108 }
109
110 scope := memory.Scope{
111 UserID: t.userID,
112 ProjectID: t.projectID,
113 Shared: t.shared,
114 }
115 ns := scope.Namespace()
116
117 payload := map[string]any{
118 "file": "facts.md",
119 "namespace": ns,
120 "mode": "append",
121 "title": "Project fact",
122 "content": fact,
123 }
124
125 return t.memoryWrite.Execute(ctx, payload, tc)
126}
127
128func (t *projectFactTool) Prompt() string {
129 return `Use this tool to store stable project-level facts and conventions, such as coding standards, deployment rules, and critical decisions.`

Callers 1

mainFunction · 0.95

Calls 2

NamespaceMethod · 0.95
ExecuteMethod · 0.65

Tested by

no test coverage detected