Skip to main content

Overview

The LSP Code Intelligence module provides agent-centric tools that leverage Language Server Protocol (LSP) for semantic code analysis. When LSP is unavailable, it gracefully falls back to regex-based extraction. This enables agents to:
  • List symbols (functions, classes, methods) in files
  • Find definitions of symbols
  • Find references to symbols
  • Get diagnostics (errors, warnings)

Installation

Quick Start

LSP Tools

lsp_list_symbols

Lists all symbols (functions, classes, methods) in a file:
Example Response:

lsp_find_definition

Finds where a symbol is defined:
Example Response:

lsp_find_references

Finds all references to a symbol:

lsp_get_diagnostics

Gets diagnostics (errors, warnings) for a file:

Fallback Behavior

When LSP is unavailable (e.g., language server not installed), the tools automatically fall back to regex-based extraction: The response includes lsp_used and fallback_used flags to indicate which method was used.

Supported Languages

With full LSP support:
  • Python - via python-lsp-server (pylsp)
  • JavaScript/TypeScript - via typescript-language-server
  • Go - via gopls
  • Rust - via rust-analyzer
With regex fallback:
  • Python (.py)
  • JavaScript/TypeScript (.js, .ts, .jsx, .tsx)
  • Go (.go)
  • Rust (.rs)
  • Java (.java)
  • C/C++ (.c, .cpp, .h)

Architecture

CLI Usage

Operational Notes

Performance

  • LSP client is lazy-loaded only when lsp_enabled=True
  • First LSP request may take longer (server startup)
  • Subsequent requests are fast (server stays running)

Dependencies

  • python-lsp-server (optional) - For Python LSP support
  • pyright (optional) - Alternative Python LSP

Production Caveats

  • LSP requires language server to be installed
  • Large files may take longer to analyze
  • Fallback regex is less accurate than LSP