| 23967 | } |
| 23968 | |
| 23969 | static char *search_code_with_context(cbm_mcp_server_t *srv, const char *context_value) { |
| 23970 | char req[256]; |
| 23971 | snprintf(req, sizeof(req), |
| 23972 | "{\"project\":\"test-project\",\"pattern\":\"needle-context-window\"," |
| 23973 | "\"format\":\"json\",\"context\":%s,\"limit\":5}", |
| 23974 | context_value); |
| 23975 | char *resp = cbm_mcp_handle_tool(srv, "search_code", req); |
| 23976 | if (!resp) { |
| 23977 | return NULL; |
| 23978 | } |
| 23979 | char *inner = extract_text_content(resp); |
| 23980 | free(resp); |
| 23981 | return inner; |
| 23982 | } |
| 23983 | |
| 23984 | /* Row-0 context object of a json-format search_code answer, or NULL when the |
| 23985 | * answer carries no context column. *doc_out owns the memory either way. */ |
no test coverage detected