Prerequisites
- Python 3.10 or higher
- PraisonAI Agents package installed (
pip install praisonaiagents) - A language server binary on
PATH(see Language Server Installation)
Quick Start
1
Install
2
Enable LSP navigation tools
3
Use tool names as strings
How It Works
The Five Tools
lsp_definition
Go to the definition of a symbol.lsp_references
Find all references to a symbol across the codebase.lsp_hover
Get type, signature, or documentation at an exact position.lsp_hover requires exact (line, character) — it does not accept a symbol name. Use lsp_document_symbols first to find the position.lsp_document_symbols
List every symbol defined in a file — classes, functions, methods, variables.
Nested symbols (methods inside classes) are flattened and tagged with their parent’s name.
lsp_workspace_symbols
Search for a symbol by name across the entire workspace.Choosing Between Position and Symbol
- Explicit position —
lineandcharacterare 0-indexed (LSP convention). Output shows them 1-indexed so results are human-readable. - Symbol name —
symbol="my_func"finds the first word-boundary occurrence in the file automatically. Recommended when you don’t know the exact column.
Language Server Installation
Each supported language needs its server binary onPATH. If the server is missing, the tool returns a clear error — it never crashes the agent.
When the server is missing, the tool returns
Error: python language server not installed; install it to use lsp navigation (falling back to grep is advised) — the agent keeps running and can fall back to other search tools.User Interaction Flow
A typical agent session using LSP tools:User: “Who calls theloginfunction?” Agent pickslsp_references("src/auth.py", symbol="login")and calls it. Tool returns:Agent replies: “Theloginfunction is called in 3 places: inuser.pyat line 45 when handling a user view, inendpoints.pyat line 88 inside an API endpoint guard, and intest_auth.pyat line 22 in a unit test.”
Common Patterns
Refactor safely: find all references before changing a signatureBest Practices
Prefer symbol= over hard-coded (line, character)
Prefer symbol= over hard-coded (line, character)
The LLM rarely knows exact column numbers. Pass
symbol="my_func" instead — the tool locates the first word-boundary occurrence and converts it to a position automatically.Combine lsp_references with lsp_definition for full context
Combine lsp_references with lsp_definition for full context
Before editing anything, use
lsp_definition to find where it’s defined, then lsp_references to see every call site. This prevents breaking callers you didn’t know existed.Keep workspace-symbol queries narrow
Keep workspace-symbol queries narrow
Results are capped at 100. If you see
... (N more; narrow your query), use a more specific substring — "parse_config" instead of "parse".Related
AST-Grep Tools
Structural code search and rewrite with AST patterns
Shell Tools
Execute shell commands and system operations
File Tools
File system read, write, and search operations
LSP Navigation (Feature)
Deep dive into how LSP navigation works

