Labsco
ast2llm logo

AST2LLM for Go

โ˜… 7

from ast2llm

An AST-powered tool that enhances LLM context by automatically injecting relevant Go code structures into prompts.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

AST2LLM for Go

Local AST-powered context enhancement tool for LLM

Automatically injects relevant code structure into your prompts using precise Go AST analysis.

Demo

Our MCP server provides the parse-go tool that:

  1. Analyzes your Go project structure
  2. Identifies external type declarations
  3. Packages context for LLM prompts
  4. Delivers 3-5x faster context resolution than grap-based approaches

For example, the demo above shows the model calling the tool to get the missing information about the fields of the MyDTO structure. In response, the model received all the necessary information from the response:

Used Imported Structs (from this project, if available):
  Struct: testme/dto.MyDTO
    Fields:
      - Foo string
      - Bar int

Note About Current State

This MCP server is under active development and may have stability issues or incomplete functionality. We're working hard to improve it, but you might encounter:

  • Occasional parsing errors
  • Limited type support in current version
  • Performance bottlenecks with large codebases

Found an issue?
Open a GitHub Issue to help us improve! We appreciate all bug reports and feature requests.

Roadmap

Language Support

  • Support for struct types
  • Support for interface types
  • Support for function types
  • Support for global variables

Multi-file Context

  • Analyze multiple open files simultaneously
  • Cross-file dependency resolution
  • Context-aware import optimization

AST Representation

  • Improved type hierarchy visualization
  • Research optimal AST representation for LLMs. Provide different output formats tailored to various scenarios like in repomix:
    • XML: For compatibility with traditional solutions akin to Repomix.
    • JSON: A modern format suitable for integration with contemporary tools and environments.
    • Markdown: An easily readable format ideal for quick viewing and documenting changes.

Performance

  • Incremental parsing
  • AST caching
  • Parallel analysis