MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / findResponse

Function findResponse

__tests__/mcp-daemon.test.ts:106–117  ·  view source on GitHub ↗

Find a JSON-RPC response with the given id (result OR error) on stdout.

(stdout: string[], id: number)

Source from the content-addressed store, hash-verified

104
105/** Find a JSON-RPC response with the given id (result OR error) on stdout. */
106function findResponse(stdout: string[], id: number): any | null {
107 for (const line of stdout) {
108 if (!line.trim()) continue;
109 try {
110 const parsed = JSON.parse(line);
111 if (parsed && parsed.id === id && (parsed.result !== undefined || parsed.error !== undefined)) {
112 return parsed;
113 }
114 } catch { /* not JSON */ }
115 }
116 return null;
117}
118
119function waitFor<T>(
120 predicate: () => T | undefined | null | false,

Callers 1

mcp-daemon.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected