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. */
| 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. */ |
| 692 | static 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 | |
| 713 | static bool ha_envelope_succeeded(const char *envelope) { |
| 714 | yyjson_doc *doc = envelope ? yyjson_read(envelope, strlen(envelope), 0) : NULL; |
no test coverage detected