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

Function response_contains_json_fragment

tests/test_mcp.c:88–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88static bool response_contains_json_fragment(const char *response, const char *fragment) {
89 if (!response || !fragment) {
90 return false;
91 }
92 if (strstr(response, fragment)) {
93 return true;
94 }
95
96 char escaped[512];
97 size_t out = 0;
98 for (size_t i = 0; fragment[i] && out + 2 < sizeof(escaped); i++) {
99 if (fragment[i] == '"') {
100 escaped[out++] = '\\';
101 }
102 escaped[out++] = fragment[i];
103 }
104 escaped[out] = '\0';
105 return strstr(response, escaped) != NULL;
106}
107
108static void restore_cache_dir(const char *saved_copy) {
109 if (saved_copy) {

Calls

no outgoing calls

Tested by

no test coverage detected