The Language Server Protocol is a standard for editor-agnostic language features. Most programming languages have LSP servers available.
Available tools
| Tool | Description | Read-only |
|---|---|---|
lsp_workspace | Get workspace info and available capabilities | Yes |
lsp_hover | Get type info and documentation for a symbol | Yes |
lsp_definition | Find where a symbol is defined | Yes |
lsp_references | Find all references to a symbol | Yes |
lsp_document_symbols | List all symbols in a file | Yes |
lsp_workspace_symbols | Search symbols across the workspace | Yes |
lsp_diagnostics | Get errors and warnings for a file | Yes |
lsp_code_actions | Get available quick fixes and refactorings | Yes |
lsp_call_hierarchy | Find incoming and outgoing calls | Yes |
lsp_type_hierarchy | Find supertypes and subtypes | Yes |
lsp_implementations | Find implementations of an interface | Yes |
lsp_signature_help | Get function signature at a call site | Yes |
lsp_inlay_hints | Get type annotations and parameter names | Yes |
lsp_rename | Rename a symbol across the workspace | No |
lsp_format | Format a file | No |
Configuration
Options
The LSP server executable. Must be available in
PATH or installed via the version property.Command-line arguments passed to the LSP server process.
Environment variables for the LSP server process.
File extensions this LSP handles (e.g.
[".go", ".mod"]). Used to route file requests to the correct server when multiple LSP servers are configured.Package reference for auto-installing the LSP server if it is not found in
PATH. See Auto-installing tools.Common LSP servers
Multiple LSP servers
Configure multiple LSP servers for polyglot codebases:agent.yaml
Example agent
agent.yaml
Position format
All LSP tools use 1-based line and character positions:- Line 1 is the first line of the file.
- Character 1 is the first character on the line.
Recommended workflow
The LSP tool includes built-in instructions that guide the agent to:- Start with
lsp_workspaceto discover available capabilities. - Use
lsp_workspace_symbolsto find relevant code. - Use
lsp_referencesbefore modifying any symbol. - Check
lsp_diagnosticsafter every code change. - Apply
lsp_formatafter edits are complete.
Auto-installation
Docker Agent can automatically download and install LSP servers if they are not found inPATH. Set the version property to a package reference, or let Docker Agent auto-detect it from the command name.
See Auto-installing tools for details.
Related
Filesystem
Read and write code files alongside LSP.
Shell
Run build and test commands.
Tool configuration
Auto-installing tools and full toolset options.
Think
Plan refactors before executing them.