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

Function atlas_open_project

src/ui/http_server.c:2384–2401  ·  view source on GitHub ↗

Open the query store for ?project=... or reply with the right error. * Returns NULL after replying. */

Source from the content-addressed store, hash-verified

2382/* Open the query store for ?project=... or reply with the right error.
2383 * Returns NULL after replying. */
2384static cbm_store_t *atlas_open_project(cbm_http_conn_t *c, const cbm_http_req_t *req, char *project,
2385 size_t project_cap) {
2386 if (!cbm_http_query_param(req->query, "project", project, (int)project_cap) ||
2387 project[0] == '\0') {
2388 cbm_http_replyf(c, 400, g_cors_json, "{\"error\":\"missing project parameter\"}");
2389 return NULL;
2390 }
2391 char db_path[1024];
2392 db_path_for_project(project, db_path, sizeof(db_path));
2393 if (!cbm_file_exists(db_path)) {
2394 cbm_http_replyf(c, 404, g_cors_json, "{\"error\":\"project not found\"}");
2395 return NULL;
2396 }
2397 cbm_store_t *store = cbm_store_open_path_query(db_path);
2398 if (!store)
2399 cbm_http_replyf(c, 500, g_cors_json, "{\"error\":\"cannot open store\"}");
2400 return store;
2401}
2402
2403static void atlas_reply_json(cbm_http_conn_t *c, char *json, int missing_status,
2404 const char *missing_body) {

Callers 15

handle_atlas_treeFunction · 0.85
handle_atlas_symbolFunction · 0.85
handle_atlas_repositoryFunction · 0.85
handle_atlas_metricsFunction · 0.85
handle_atlas_traceFunction · 0.85
handle_atlas_whoFunction · 0.85
handle_atlas_impactFunction · 0.85
handle_atlas_whyFunction · 0.85
handle_atlas_handoutFunction · 0.85
handle_atlas_blastFunction · 0.85

Calls 5

cbm_http_query_paramFunction · 0.85
cbm_http_replyfFunction · 0.85
db_path_for_projectFunction · 0.85
cbm_file_existsFunction · 0.85

Tested by

no test coverage detected