mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-24 06:23:06 +08:00
Before this commit, inject_context_once ran only inside handle_search_graph, although the config registry promised context on the first tool response. trace_path, query_graph, search_code, get_code, and first-call errors could omit schema/status metadata, while codebase://status maintained a separate readiness implementation.
Route every cbm_mcp_handle_tool result through one JSON/TOON-preserving wrapper before release_request_store. Share add_project_status_summary with codebase://status for indexing, empty, ready, dirty-overlay, coverage-generation, and ecosystem state. Reuse CBM_CONTEXT_INJECTION, the key-function limit, freshness definitions, and profile-aware index recovery actions. Emit invalid search_code mode warnings inside JSON and TOON payloads.
The feature parent be89d496 injected only from handle_search_graph; upstream parent 97ce23f had no context injector. The result retains the feature behavior and applies it at the common dispatcher without changing the upstream tool schemas.
Verified: token_reduction 56/56, mcp 314/314, input_validation 56/56, and tool_consolidation 114/114 under ASan/UBSan; test-leak 1194/1194 with 0 leaks; test-syntax and lint-source-safety pass. Clang analyzer diagnostics do not intersect changed production or new-test ranges.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>