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

Function ha_build_args

src/cli/hook_augment.c:360–378  ·  view source on GitHub ↗

Build the search_graph args JSON: {"project":..,"name_pattern":".*tok.*", * "limit":N}. `token` is a pure identifier so regex embedding is safe. */

Source from the content-addressed store, hash-verified

358/* Build the search_graph args JSON: {"project":..,"name_pattern":".*tok.*",
359 * "limit":N}. `token` is a pure identifier so regex embedding is safe. */
360static char *ha_build_args(const char *project, const char *token) {
361 yyjson_mut_doc *doc = yyjson_mut_doc_new(NULL);
362 yyjson_mut_val *root = yyjson_mut_obj(doc);
363 yyjson_mut_doc_set_root(doc, root);
364
365 char name_pattern[HA_MAX_TOKEN + 8];
366 snprintf(name_pattern, sizeof(name_pattern), ".*%s.*", token);
367
368 yyjson_mut_obj_add_str(doc, root, "project", project);
369 yyjson_mut_obj_add_str(doc, root, "name_pattern", name_pattern);
370 yyjson_mut_obj_add_int(doc, root, "limit", HA_RESULT_LIMIT);
371 /* Programmatic consumer: search_graph defaults to TOON text, but
372 * ha_format_context parses the inner payload as JSON ("results"). */
373 yyjson_mut_obj_add_str(doc, root, "format", "json");
374
375 char *out = yyjson_mut_write(doc, 0, NULL);
376 yyjson_mut_doc_free(doc);
377 return out; /* caller frees */
378}
379
380/* Parse the MCP envelope returned by cbm_mcp_handle_tool and, if it is a
381 * successful search_graph result with >=1 hit, format a compact

Callers 1

ha_resolve_and_queryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected