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

Function mockSdk

test/claude-bridge.test.ts:44–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42}
43
44function mockSdk() {
45 const functions = new Map<string, Function>();
46 return {
47 registerFunction: (idOrOpts: string | { id: string }, handler: Function) => {
48 const id = typeof idOrOpts === "string" ? idOrOpts : idOrOpts.id;
49 functions.set(id, handler);
50 },
51 registerTrigger: () => {},
52 trigger: async (idOrInput: string | { function_id: string; payload: unknown }, data?: unknown) => {
53 const id = typeof idOrInput === "string" ? idOrInput : idOrInput.function_id;
54 const payload = typeof idOrInput === "string" ? data : idOrInput.payload;
55 const fn = functions.get(id);
56 if (!fn) throw new Error(`No function: ${id}`);
57 return fn(payload);
58 },
59 };
60}
61
62const enabledConfig: ClaudeBridgeConfig = {
63 enabled: true,

Callers 1

Calls 2

setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected