spmallette opened a new pull request, #3336:
URL: https://github.com/apache/tinkerpop/pull/3336

   Adds `Translator` infrastructure to gremlin-javascript and adds that 
capability to gremlin-mcp. Might be best to take the changes one commit at at 
time for review as they build on each other mostly. I'm hoping that this 
[change](https://github.com/apache/tinkerpop/compare/js-translator?expand=1#diff-36f26ecf6af51de0ba1851a3ea4cb7338259f093981c771a5b05fc8a7ca22f44R51)
 is temporary and that a follow-on refactor during code freeze week will clean 
that up and make the javascript setup much cleaner. If that does not get done 
there will be some extra steps required during release. 
   
   Here's the big ticket changes to consider in review:
   
   1. A new multi-language Gremlin translator in gremlin-javascript (~3,200 
lines)
                                                                                
                                                                                
                                                                       
   Ten new TypeScript files under lib/language/translator/ implement a complete 
ANTLR-visitor-based translation pipeline that converts canonical Gremlin to 
JavaScript, Python, Go, Java, Groovy, .NET, and an anonymized form. This
     is the largest and most novel code surface. Reviewers should check: 
correctness of each language's output formatting (especially 
DotNetTranslateVisitor.ts at 891 lines), the translations.json corpus (44,031 
lines, generated   
     from Groovy test data), and whether the corpus test coverage actually 
exercises edge cases meaningfully.                                              
                                                                          
                                                                                
                                                                                
                                                                       
   2. LLM-backed normalization pipeline in gremlin-mcp (translator/index.ts, 
llm.ts, normalizers/shared.ts)
                                                                                
                                                                                
                                                                       
   The translate_gremlin_query MCP tool now has a two-stage pipeline: 
mechanical normalization (stripping gremlingo. prefixes, PascalCase→camelCase, 
etc.) followed by LLM normalization via MCP sampling. The LLM fallback silently
     swallows errors and falls back to the mechanically-normalized input. 
Reviewers should scrutinize: the silent catch in normalizeAndTranslate (could 
mask translation failures), the LLM system prompt's canonical-format rules for 
     completeness and accuracy, and whether there are injection risks in 
passing user-supplied Gremlin directly to the LLM.
                                                                                
                                                                                
                                                                       
   3. Offline mode / dynamic import gate in server.ts
                                                                                
                                                                                
                                                                       
   The server now checks GREMLIN_MCP_ENDPOINT at startup and dynamically 
imports connection.ts (and thus the Gremlin driver) only when an endpoint is 
configured. When offline, a stub GremlinClient layer is used that fails every
     operation immediately. This is a correctness-critical change — the memory 
file notes this was still broken as of last session. Reviewers should verify: 
that the dynamic import actually prevents the static module graph from    
     loading the driver, that the GremlinClientOfflineLive stub surfaces errors 
cleanly to MCP tool callers rather than crashing the server, and that config.ts 
properly models GREMLIN_MCP_ENDPOINT as optional.
   
   VOTE +1
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to