module

CrystalMcp::Tools::Compiler

Compiler related tools for the Crystal MCP server.

Constants

Log = ::Log.for("tools.compiler")

Instance methods

check_build(file : String) : String

Checks if a Crystal file builds correctly.

Returns a JSON string with the build check result.

Parameters:

  • file: Path to the Crystal file.
Source
definitions

Returns the tool definitions for compiler tools.

Source
expand_macro(file : String, line : Int32, col : Int32) : String

Expands macros for a specific location in a Crystal file.

Returns a JSON string with the expanded macro.

Parameters:

  • file: Path to the Crystal file.
  • line: Line number (1-based).
  • col: Column number (1-based).
Source
get_context(file : String, line : Int32, col : Int32) : String

Gets context for a specific location in a Crystal file.

Returns a JSON string with the context information.

Parameters:

  • file: Path to the Crystal file.
  • line: Line number (1-based).
  • col: Column number (1-based).
Source
get_hierarchy(file : String, filter : String | Nil = nil) : String

Inspects the type hierarchy of a Crystal file.

Returns a JSON string with the hierarchy.

Parameters:

  • file: Path to the Crystal file.
  • filter: Optional regex/string filter for type names.
Source
get_implementations(file : String, line : Int32, col : Int32) : String

Finds implementations for a specific location in a Crystal file.

Returns a JSON string with the implementations.

Parameters:

  • file: Path to the Crystal file.
  • line: Line number (1-based).
  • col: Column number (1-based).
Source