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

Function cbm_remove_json_named_mcp

src/cli/cli.c:2173–2207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2171}
2172
2173static int cbm_remove_json_named_mcp(const char *config_path, const char *const *object_path,
2174 size_t path_len, cbm_json_mcp_schema_t schema,
2175 const char *entry_name, const char *argument,
2176 const char *expected_binary) {
2177 if (!config_path || !object_path || !entry_name || !entry_name[0]) {
2178 return CLI_ERR;
2179 }
2180 char *document = NULL;
2181 size_t document_length = 0U;
2182 int read_result = cbm_json_like_read_document(config_path, &document, &document_length);
2183 if (read_result == 1) {
2184 free(document);
2185 return CLI_OK;
2186 }
2187 if (read_result < 0) {
2188 free(document);
2189 return CLI_ERR;
2190 }
2191 int ownership =
2192 cbm_json_mcp_snapshot_ownership(document, document_length, object_path, path_len, schema,
2193 entry_name, argument, expected_binary, NULL, NULL);
2194 if (ownership == CBM_JSON_LIKE_OBJECT_MISSING || ownership == CBM_JSON_LIKE_OBJECT_MISMATCH ||
2195 ownership == CBM_JSON_MCP_OWNERSHIP_STALE) {
2196 free(document);
2197 return CLI_OK;
2198 }
2199 if (ownership != CBM_JSON_LIKE_OBJECT_MATCH) {
2200 free(document);
2201 return CLI_ERR;
2202 }
2203 int edit_result = cbm_json_like_remove_entry_if_unchanged(
2204 config_path, object_path, path_len, entry_name, document, document_length);
2205 free(document);
2206 return edit_result == 0 ? CLI_OK : CLI_ERR;
2207}
2208
2209static int cbm_remove_json_mcp(const char *config_path, const char *const *object_path,
2210 size_t path_len, cbm_json_mcp_schema_t schema,

Callers 3

cbm_remove_json_mcpFunction · 0.85
cbm_remove_junie_mcpFunction · 0.85

Tested by

no test coverage detected