| 24403 | } search_root_probe_t; |
| 24404 | |
| 24405 | static search_root_probe_t search_root_probe(cbm_mcp_server_t *srv, const char *args) { |
| 24406 | search_root_probe_t probe = {0}; |
| 24407 | char *response = cbm_mcp_handle_tool(srv, "search_code", args); |
| 24408 | char *inner = response ? extract_text_content(response) : NULL; |
| 24409 | probe.ok = response && !strstr(response, "\"isError\":true") && inner; |
| 24410 | if (probe.ok) { |
| 24411 | probe.inside_file = strstr(inner, "main.c") != NULL; |
| 24412 | probe.inside_dir_link = strstr(inner, "alias/same.c") != NULL; |
| 24413 | probe.inside_file_link = strstr(inner, "mirror.c") != NULL; |
| 24414 | static const char *const outside_markers[] = {"ROOTCHECK_NEEDLE_FAR", "FAR_DIR_SYMBOL", |
| 24415 | "deep.c", "sym.c", "link.c"}; |
| 24416 | for (size_t i = 0; i < sizeof(outside_markers) / sizeof(outside_markers[0]); i++) { |
| 24417 | if (strstr(inner, outside_markers[i])) { |
| 24418 | probe.outside = true; |
| 24419 | } |
| 24420 | } |
| 24421 | } |
| 24422 | free(inner); |
| 24423 | free(response); |
| 24424 | return probe; |
| 24425 | } |
| 24426 | |
| 24427 | #define SEARCH_ROOT_ARGS(extra) \ |
| 24428 | "{\"pattern\":\"ROOTCHECK_NEEDLE\",\"project\":\"search-root\"" extra "}" |
no test coverage detected