MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / execute

Method execute

src/tools/builtin/memory.ts:73–93  ·  view source on GitHub ↗
(args: z.infer<typeof RecallArgs>, ctx: ToolContext)

Source from the content-addressed store, hash-verified

71 argsSchema = RecallArgs;
72
73 async execute(args: z.infer<typeof RecallArgs>, ctx: ToolContext): Promise<ToolResult> {
74 const cwd = ctx.cwd ?? process.cwd();
75 const limit = args.limit ?? 20;
76 const scope = args.scope ?? 'all';
77 const q = args.query?.trim();
78 const store = getSessionStore();
79 const get = (s: 'user' | 'project') => q ? store.searchFacts(q, s, cwd, limit) : store.getFactsByScope(s, cwd, limit);
80 const sections: string[] = [];
81 if (scope === 'all' || scope === 'user') {
82 const u = get('user');
83 if (u.length) sections.push(`User memory (all projects) — ${u.length}:\n${u.map(f => ' - ' + f).join('\n')}`);
84 }
85 if (scope === 'all' || scope === 'project') {
86 const p = get('project');
87 if (p.length) sections.push(`Project memory (${cwd}) — ${p.length}:\n${p.map(f => ' - ' + f).join('\n')}`);
88 }
89 if (sections.length === 0) {
90 return { content: q ? `No facts matching "${q}"${scope === 'all' ? '' : ` in ${scope}`}.` : `No ${scope === 'all' ? '' : scope + ' '}facts stored yet.` };
91 }
92 return { content: (q ? `🔎 Search "${q}":\n\n` : '') + sections.join('\n\n') };
93 }
94}
95
96const ForgetArgs = z.object({

Callers

nothing calls this directly

Calls 3

getSessionStoreFunction · 0.85
getFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected