MCPcopy
hub / github.com/rohitg00/agentmemory / listPinnedSlots

Function listPinnedSlots

src/functions/slots.ts:172–183  ·  view source on GitHub ↗
(kv: StateKV)

Source from the content-addressed store, hash-verified

170}
171
172export async function listPinnedSlots(kv: StateKV): Promise<MemorySlot[]> {
173 const [project, global] = await Promise.all([
174 kv.list<MemorySlot>(KV.slots),
175 kv.list<MemorySlot>(KV.globalSlots),
176 ]);
177 const merged = new Map<string, MemorySlot>();
178 for (const s of global) merged.set(s.label, s);
179 for (const s of project) merged.set(s.label, s);
180 return Array.from(merged.values())
181 .filter((s) => s.pinned && s.content.trim().length > 0)
182 .sort((a, b) => a.label.localeCompare(b.label));
183}
184
185export function renderPinnedContext(slots: MemorySlot[]): string {
186 if (slots.length === 0) return "";

Callers 2

slots.test.tsFile · 0.85
registerContextFunctionFunction · 0.85

Calls 2

listMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected