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:lsp_find_definition
Finds where a symbol is defined: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:| Tool | LSP Method | Fallback Method |
|---|---|---|
lsp_list_symbols | textDocument/documentSymbol | Regex pattern matching |
lsp_find_definition | textDocument/definition | Grep search for definitions |
lsp_find_references | textDocument/references | Grep search for symbol usage |
lsp_get_diagnostics | textDocument/publishDiagnostics | N/A (LSP only) |
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
- 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 supportpyright(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
Related
- Agent-Centric Tools - All agent-centric tools
- Debug CLI - Debug commands for LSP
- Interactive Runtime - Runtime configuration

