MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / count_in_response

Function count_in_response

tests/test_incremental.c:131–144  ·  view source on GitHub ↗

Parse integer from JSON response (handles nested MCP envelope) */

Source from the content-addressed store, hash-verified

129
130/* Parse integer from JSON response (handles nested MCP envelope) */
131static int count_in_response(const char *resp, const char *key) {
132 if (!resp)
133 return -1;
134 char pattern[64];
135 snprintf(pattern, sizeof(pattern), "\"%s\":", key);
136 const char *p = strstr(resp, pattern);
137 if (p)
138 return atoi(p + strlen(pattern));
139 snprintf(pattern, sizeof(pattern), "\\\"%s\\\":", key);
140 p = strstr(resp, pattern);
141 if (p)
142 return atoi(p + strlen(pattern));
143 return -1;
144}
145
146/* ── Direct store queries (more reliable than MCP for tests) ────── */
147

Callers 3

has_functionFunction · 0.85
count_by_labelFunction · 0.85
test_incremental.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected