Build the search_graph args JSON: {"project":..,"name_pattern":".*tok.*", * "limit":N}. `token` is a pure identifier so regex embedding is safe. */
| 317 | /* Build the search_graph args JSON: {"project":..,"name_pattern":".*tok.*", |
| 318 | * "limit":N}. `token` is a pure identifier so regex embedding is safe. */ |
| 319 | static char *ha_build_args(const char *project, const char *token) { |
| 320 | yyjson_mut_doc *doc = yyjson_mut_doc_new(NULL); |
| 321 | yyjson_mut_val *root = yyjson_mut_obj(doc); |
| 322 | yyjson_mut_doc_set_root(doc, root); |
| 323 | |
| 324 | char name_pattern[HA_MAX_TOKEN + 8]; |
| 325 | snprintf(name_pattern, sizeof(name_pattern), ".*%s.*", token); |
| 326 | |
| 327 | yyjson_mut_obj_add_str(doc, root, "project", project); |
| 328 | yyjson_mut_obj_add_str(doc, root, "name_pattern", name_pattern); |
| 329 | yyjson_mut_obj_add_int(doc, root, "limit", HA_RESULT_LIMIT); |
| 330 | /* Programmatic consumer: search_graph defaults to TOON text, but |
| 331 | * ha_format_context parses the inner payload as JSON ("results"). */ |
| 332 | yyjson_mut_obj_add_str(doc, root, "format", "json"); |
| 333 | |
| 334 | char *out = yyjson_mut_write(doc, 0, NULL); |
| 335 | yyjson_mut_doc_free(doc); |
| 336 | return out; /* caller frees */ |
| 337 | } |
| 338 | |
| 339 | /* Parse the MCP envelope returned by cbm_mcp_handle_tool and, if it is a |
| 340 | * successful search_graph result with >=1 hit, format a compact |
no outgoing calls
no test coverage detected