Skip to content

Commit a3f11bd

Browse files
fix(mcp,store): address QA round 2
- Fix handle_get_code_snippet inline store-NULL check to return the same JSON error format as REQUIRE_STORE and the other inline checks: {"error":"no project loaded"} instead of a plain string - Fix smoke_guard.sh query_graph invocation: pass "query" parameter (not "cypher") to match what handle_query_graph actually reads; the wrong key caused the handler to early-return before reaching the guard - Remove extra blank line in handle_get_graph_schema guard block Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2791d0d commit a3f11bd

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/mcp/mcp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,6 @@ static char *handle_get_architecture(cbm_mcp_server_t *srv, const char *args) {
10651065
return not_indexed;
10661066
}
10671067

1068-
10691068
cbm_schema_info_t schema = {0};
10701069
cbm_store_get_schema(store, project, &schema);
10711070

@@ -1635,7 +1634,7 @@ static char *handle_get_code_snippet(cbm_mcp_server_t *srv, const char *args) {
16351634
if (!store) {
16361635
free(qn);
16371636
free(project);
1638-
return cbm_mcp_text_result("no project loaded — run index_repository first", true);
1637+
return cbm_mcp_text_result("{\"error\":\"no project loaded\"}", true);
16391638
}
16401639

16411640
char *not_indexed = verify_project_indexed(store, project);

tests/smoke_guard.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ check_handler() {
6363

6464
# ── Step 3: Test all 5 guarded handlers ───────────────────────────
6565
check_handler "search_graph" "{\"project\":\"$FAKE_PROJECT\",\"name_pattern\":\".*\"}"
66-
check_handler "query_graph" "{\"project\":\"$FAKE_PROJECT\",\"cypher\":\"MATCH (n) RETURN n LIMIT 1\"}"
66+
check_handler "query_graph" "{\"project\":\"$FAKE_PROJECT\",\"query\":\"MATCH (n) RETURN n LIMIT 1\"}"
6767
check_handler "get_graph_schema" "{\"project\":\"$FAKE_PROJECT\"}"
6868
check_handler "trace_call_path" "{\"project\":\"$FAKE_PROJECT\",\"function_name\":\"main\",\"direction\":\"both\",\"depth\":1}"
6969
check_handler "get_code_snippet" "{\"project\":\"$FAKE_PROJECT\",\"qualified_name\":\"main\"}"

0 commit comments

Comments
 (0)