Bug Description
mcp/tools.py uses [:COUPLED_WITH], [:STEP_IN_PROCESS], and [:MEMBER_OF] as KuzuDB REL table names in Cypher queries — but these tables do not exist. The schema uses a single REL TABLE GROUP called CodeRelation with a rel_type property.
The backend (core/storage/kuzu_backend.py) does it correctly — e.g. line 412:
"MATCH (n)-[r:CodeRelation]->(p:Process) "
"WHERE n.id IN $ids AND r.rel_type = 'step_in_process' "
But tools.py uses the incorrect pattern:
# Line 513 — fails with "Table COUPLED_WITH does not exist"
"MATCH (a:File)-[r:COUPLED_WITH]-(b:File) "
# Line 697 — fails with "Table STEP_IN_PROCESS does not exist"
"MATCH (n)-[:STEP_IN_PROCESS]->(p:Process), (n)-[:MEMBER_OF]->(c:Community) "
Affected Tools
axon_coupling — 3 broken queries (lines 513, 844, 937)
axon_communities — 2 broken queries (lines 697, 778)
- Also affects
handle_review_risk and handle_file_context
Steps to Reproduce
pip install axoniq==1.0.1
- Index a repository:
axon index
- Call the MCP tool
axon_coupling or axon_communities
- Error:
Binder exception: Table COUPLED_WITH does not exist
Fix
Replace all [:COUPLED_WITH], [:STEP_IN_PROCESS], [:MEMBER_OF] in tools.py with [:CodeRelation] + WHERE r.rel_type = '...' filter — matching the pattern already used in kuzu_backend.py.
Example fix for coupling:
# Before (broken):
"MATCH (a:File)-[r:COUPLED_WITH]-(b:File) "
"WHERE a.file_path = '...' "
# After (working):
"MATCH (a:File)-[r:CodeRelation]-(b:File) "
"WHERE a.file_path = '...' AND r.rel_type = 'coupled_with' "
For the communities cross-process query (line 697), the multi-relationship MATCH must be split into sequential MATCHes since CodeRelation is a single REL TABLE GROUP:
# Before (broken):
"MATCH (n)-[:STEP_IN_PROCESS]->(p:Process), (n)-[:MEMBER_OF]->(c:Community) "
"WITH p.name AS proc, ..."
# After (working):
"MATCH (n)-[r_sip:CodeRelation]->(p:Process) "
"WHERE r_sip.rel_type = 'step_in_process' "
"WITH n, p "
"MATCH (n)-[r_mo:CodeRelation]->(c:Community) "
"WHERE r_mo.rel_type = 'member_of' "
"WITH p.name AS proc, ..."
Environment
- axoniq 1.0.1
- Python 3.12
- KuzuDB (via pip dependency)
Happy to submit a PR if helpful.
Bug Description
mcp/tools.pyuses[:COUPLED_WITH],[:STEP_IN_PROCESS], and[:MEMBER_OF]as KuzuDB REL table names in Cypher queries — but these tables do not exist. The schema uses a single REL TABLE GROUP calledCodeRelationwith arel_typeproperty.The backend (
core/storage/kuzu_backend.py) does it correctly — e.g. line 412:But
tools.pyuses the incorrect pattern:Affected Tools
axon_coupling— 3 broken queries (lines 513, 844, 937)axon_communities— 2 broken queries (lines 697, 778)handle_review_riskandhandle_file_contextSteps to Reproduce
pip install axoniq==1.0.1axon indexaxon_couplingoraxon_communitiesBinder exception: Table COUPLED_WITH does not existFix
Replace all
[:COUPLED_WITH],[:STEP_IN_PROCESS],[:MEMBER_OF]intools.pywith[:CodeRelation]+WHERE r.rel_type = '...'filter — matching the pattern already used inkuzu_backend.py.Example fix for coupling:
For the communities cross-process query (line 697), the multi-relationship MATCH must be split into sequential MATCHes since
CodeRelationis a single REL TABLE GROUP:Environment
Happy to submit a PR if helpful.