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

Function main_index_worker_scope_request

src/main.c:851–863  ·  view source on GitHub ↗

A supervised worker runs in the DAEMON's environment, not the requesting * client's. The daemon admitted this request under the client's session policy * and re-executed us with the canonical repo_path in the args (both daemon * spawn paths rewrite it), so the request itself is the worker's workspace * scope: repository == session root == allowed root. Without this, a fresh * server fell back

Source from the content-addressed store, hash-verified

849 * missing repository as the tool error it always was, instead of the
850 * supervisor misreading a refused worker as a crash. */
851static const char *main_index_worker_scope_request(cbm_mcp_server_t *srv, const char *args_json) {
852 char *repo_path = cbm_mcp_get_string_arg(args_json, "repo_path");
853 if (!repo_path || !repo_path[0]) {
854 free(repo_path);
855 return "request names no repo_path";
856 }
857 char canonical[MAIN_PATH_CAP];
858 bool exists = cbm_canonical_path(repo_path, canonical, sizeof(canonical)) != 0;
859 const char *scope = exists ? canonical : repo_path;
860 bool scoped = cbm_mcp_server_set_session_context(srv, scope, exists ? scope : NULL);
861 free(repo_path);
862 return scoped ? NULL : "session context could not be installed";
863}
864
865static int run_cli(int argc, char **argv, cbm_project_lock_manager_t *project_locks,
866 main_local_maintenance_context_t *maintenance_context) {

Callers 1

run_cliFunction · 0.85

Calls 3

cbm_mcp_get_string_argFunction · 0.85
cbm_canonical_pathFunction · 0.85

Tested by

no test coverage detected