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

Function mockSdk

test/auto-forget.test.ts:36–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34}
35
36function mockSdk() {
37 const functions = new Map<string, Function>();
38 return {
39 registerFunction: (idOrOpts: string | { id: string }, handler: Function) => {
40 const id = typeof idOrOpts === "string" ? idOrOpts : idOrOpts.id;
41 functions.set(id, handler);
42 },
43 registerTrigger: () => {},
44 trigger: async (idOrInput: string | { function_id: string; payload: unknown }, data?: unknown) => {
45 const id = typeof idOrInput === "string" ? idOrInput : idOrInput.function_id;
46 const payload = typeof idOrInput === "string" ? data : idOrInput.payload;
47 const fn = functions.get(id);
48 if (!fn) throw new Error(`No function: ${id}`);
49 return fn(payload);
50 },
51 };
52}
53
54function makeMemory(overrides: Partial<Memory> = {}): Memory {
55 return {

Callers 1

Calls 2

setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected