diff --git a/gitnexus/src/mcp/local/local-backend.ts b/gitnexus/src/mcp/local/local-backend.ts index b0beff286..9ae45ee6a 100644 --- a/gitnexus/src/mcp/local/local-backend.ts +++ b/gitnexus/src/mcp/local/local-backend.ts @@ -636,6 +636,11 @@ export class LocalBackend { } } + async executeCypher(repoName: string, query: string): Promise { + const repo = await this.resolveRepo(repoName); + return this.cypher(repo, { query }); + } + private async cypher(repo: RepoHandle, params: { query: string }): Promise { await this.ensureInitialized(repo.id); diff --git a/gitnexus/src/server/api.ts b/gitnexus/src/server/api.ts index 374c66b10..fbe0ebcd6 100644 --- a/gitnexus/src/server/api.ts +++ b/gitnexus/src/server/api.ts @@ -39,7 +39,7 @@ const buildGraph = async ( query = `MATCH (n:${table}) RETURN n.id AS id, n.name AS name, n.filePath AS filePath, n.startLine AS startLine, n.endLine AS endLine, n.content AS content`; } - const result = await backend.callTool('cypher', { repo: repoName, query }); + const result = await backend.executeCypher(repoName, query); // cypher returns the rows directly (array), or { error } on failure const rows = Array.isArray(result) ? result : []; @@ -71,10 +71,10 @@ const buildGraph = async ( const relationships: GraphRelationship[] = []; try { - const relResult = await backend.callTool('cypher', { - repo: repoName, - query: `MATCH (a)-[r:CodeRelation]->(b) RETURN a.id AS sourceId, b.id AS targetId, r.type AS type, r.confidence AS confidence, r.reason AS reason, r.step AS step`, - }); + const relResult = await backend.executeCypher( + repoName, + `MATCH (a)-[r:CodeRelation]->(b) RETURN a.id AS sourceId, b.id AS targetId, r.type AS type, r.confidence AS confidence, r.reason AS reason, r.step AS step`, + ); const relRows = Array.isArray(relResult) ? relResult : []; for (const row of relRows) {