feat: mcp api v2 composition tweaks (PR-V2-2)#50
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Post-merge audit: PR-V2-2 — composition tweaksVerdict: Approved ✅ (post-merge — no merge gate, but a clean audit and one cleanup follow-up worth tracking). PR is on-spec for Scope discipline (out-of-scope checks)
Plan compliance
TestsDelta vs post-V2-1 baseline (360): +8 new = 6 prescribed compose tests + 2 bonus Manual evidence reproducedRebuilt fixture at 1. ✅ Exact match against PR description's example. 2. ✅ All 9 edge types present with non-zero counts. Total in-graph edges from Notes that earned my trust
Observations (non-blocking)
Plan deltasTwo file additions to the plan's PR-V2-2 deliverable list — both justified:
Audit complete. Master is at I noticed |
Scope
Implements
plans/PLAN-MCP-API-V2.md§PR-V2-2 — composition tweaks: edge_summary, symbol_id, meta edge countson branchfeat/mcp-v2-compose.What Changed
mcp_v2.py:describe_v2now populatesNodeRecord.edge_summaryvia grouped in/out edge counts, and includes the requested inline validation-contract comment on requiredneighbors_v2params.mcp_v2.py: added_chunk_to_symbol_idand wiredsearch_v2to populatesymbol_idfrom Lance rows when present (symbol_iddirect field andmetadata.symbol_id, including JSON-text metadata).kuzu_queries.py: extendedmeta()withedge_countsfor all 9 graph edge types and addededge_counts_for(node_id)helper used bydescribe_v2.server.py: extendedGraphMetaOutput/_graph_meta_outputto surfaceedge_countsthroughgraph_meta.search_lancedb.py: ensured Java search projections includesymbol_id/metadatawhen schema has them sosearch_v2can compose intodescribe/neighborsin real execution.tests/test_mcp_v2_compose.py: added the 6 PR-V2-2 compose tests from plan.tests/test_search_lancedb.py: added projection regression tests to ensure symbol identity fields stay in selected Java columns.Semantics / Non-Goals
analyze_pr/diagnose_ignore/refresh_code_index/list_code_index_tablesextraction work (PR-V2-4).README“v2 navigation tools (preview)” section intentionally unchanged in this PR.Validation
Lint
ruff check .✅Tests
pytest tests -q✅368 passed, 4 skippedpytest tests/test_mcp_v2_compose.py -v✅6 passed(baseline + 6 new)Additional checks
python build_ast_graph.py --source-root tests/bank-chat-system --kuzu-path /tmp/pr_v2_2_check✅Sentinel checks
git diff --name-only master...HEAD->kuzu_queries.pymcp_v2.pysearch_lancedb.pyserver.pytests/test_mcp_v2_compose.pytests/test_search_lancedb.pyManual evidence
python -c "from kuzu_queries import KuzuGraph; from mcp_v2 import describe_v2; g=KuzuGraph('/tmp/pr_v2_2_check'); r=g._rows(\"MATCH (s:Symbol)-[:CALLS]->(:Symbol) RETURN s.id AS id LIMIT 1\"); sid=r[0]['id']; out=describe_v2(sid, graph=g); print(sid); print(out.record.edge_summary if out.record else None)"Observed:
describe_v2(...).record.edge_summaryreturns non-empty per-edge in/out map (example:{'CALLS': {'in': 0, 'out': 1}, 'DECLARES': {'in': 1, 'out': 0}}).python -c "from kuzu_queries import KuzuGraph; g = KuzuGraph('/tmp/pr_v2_2_check'); m = g.meta(); print(sorted((m.get('edge_counts') or {}).keys()))"Observed: all 9 edge keys present:
['ASYNC_CALLS', 'CALLS', 'DECLARES', 'DECLARES_CLIENT', 'EXPOSES', 'EXTENDS', 'HTTP_CALLS', 'IMPLEMENTS', 'INJECTS']Out of Scope Confirmed
Did not implement:
Definition of Done
masterwith agreed title and branch naming.Made with Cursor