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

Function ha_resolve_and_query

src/cli/hook_augment.c:692–711  ·  view source on GitHub ↗

Walk up from `start`, deriving a project name at each level and querying * search_graph until an indexed project is found (or the walk is exhausted). * Stops at the first non-error result: a valid project with zero hits is a * legitimate "no match" and must NOT cause a parent-directory probe. */

Source from the content-addressed store, hash-verified

690 * Stops at the first non-error result: a valid project with zero hits is a
691 * legitimate "no match" and must NOT cause a parent-directory probe. */
692static char *ha_resolve_and_query(cbm_mcp_server_t *srv, const char *start, const char *token) {
693 char *project = ha_resolve_indexed_project_with_root(srv, start, NULL, 0U);
694 if (!project) {
695 return NULL;
696 }
697 char *args = ha_build_args(project, token);
698 free(project);
699 if (!args) {
700 return NULL;
701 }
702 char *result = cbm_mcp_handle_tool(srv, "search_graph", args);
703 free(args);
704 if (!result) {
705 return NULL;
706 }
707 bool is_error = false;
708 char *context = ha_format_context(result, token, &is_error);
709 free(result);
710 return context;
711}
712
713static bool ha_envelope_succeeded(const char *envelope) {
714 yyjson_doc *doc = envelope ? yyjson_read(envelope, strlen(envelope), 0) : NULL;

Callers 1

ha_processFunction · 0.85

Calls 4

ha_build_argsFunction · 0.85
cbm_mcp_handle_toolFunction · 0.85
ha_format_contextFunction · 0.85

Tested by

no test coverage detected