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

Function resp_has_key

tests/test_incremental.c:979–996  ·  view source on GitHub ↗

Check response contains a specific key (in nested JSON) */

Source from the content-addressed store, hash-verified

977
978/* Check response contains a specific key (in nested JSON) */
979static int resp_has_key(const char *resp, const char *key) {
980 if (!resp)
981 return 0;
982 char pattern[64];
983 snprintf(pattern, sizeof(pattern), "\"%s\"", key);
984 if (strstr(resp, pattern) != NULL)
985 return 1;
986 snprintf(pattern, sizeof(pattern), "\\\"%s\\\"", key);
987 if (strstr(resp, pattern) != NULL)
988 return 1;
989 /* TOON scalar form (`key: value`), the search_graph default output. */
990 snprintf(pattern, sizeof(pattern), "%s: ", key);
991 if (strstr(resp, pattern) != NULL)
992 return 1;
993 /* TOON table-header form (`key[N]{...}:`), used by trace_path. */
994 snprintf(pattern, sizeof(pattern), "%s[", key);
995 return strstr(resp, pattern) != NULL;
996}
997
998/* Check response does NOT contain a specific key */
999static int resp_lacks_key(const char *resp, const char *key) {

Callers 2

resp_lacks_keyFunction · 0.85
test_incremental.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected