Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

style(mcp): pick the unreadable-count hint with an if/else chain

kavish-1960449f895dba
diff --git a/src/mcp/mcp.c b/src/mcp/mcp.c
index 959a07684..005e25b2c 100644
--- a/src/mcp/mcp.c
+++ b/src/mcp/mcp.c
@@ -6696,18 +6696,19 @@ static char *handle_index_status(cbm_mcp_server_t *srv, const char *args) {
safe_str_free(&proj_info.indexed_at);
safe_str_free(&proj_info.root_path);
if (counts_unreadable) {
- yyjson_mut_obj_add_str(
- doc, root, "hint",
- nodes < 0 && edges < 0
- ? "The nodes and edges tables could not be read; the database may be "
- "corrupt. Re-run index_repository(repo_path=...) or remove the project "
- "cache and re-index."
- : (nodes < 0 ? "The nodes table could not be read; the database may be "
- "corrupt. Re-run index_repository(repo_path=...) or remove "
- "the project cache and re-index."
- : "The edges table could not be read; the database may be "
- "corrupt. Re-run index_repository(repo_path=...) or remove "
- "the project cache and re-index."));
+ const char *hint;
+ if (nodes < 0 && edges < 0) {
+ hint = "The nodes and edges tables could not be read; the database may be "
+ "corrupt. Re-run index_repository(repo_path=...) or remove the project "
+ "cache and re-index.";
+ } else if (nodes < 0) {
+ hint = "The nodes table could not be read; the database may be corrupt. Re-run "
+ "index_repository(repo_path=...) or remove the project cache and re-index.";
+ } else {
+ hint = "The edges table could not be read; the database may be corrupt. Re-run "
+ "index_repository(repo_path=...) or remove the project cache and re-index.";
+ }
+ yyjson_mut_obj_add_str(doc, root, "hint", hint);
} else if (nodes == 0) {
yyjson_mut_obj_add_str(
doc, root, "hint",