agent-lsp
v0.24.7Language servers as 66 code-intelligence tools for AI agents, CI-verified on 33 languages.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
activate_skill
Activate phase enforcement for a skill workflow. Once active, tool calls are checked against the skill's phase permissions. Phases advance automatically as you call tools from later phases. Use this at the start of a skill workflow to enable safety guardrails that prevent out-of-order operations (e.g., applying edits before completing blast-radius analysis).
| Parameter | Type | Description |
|---|---|---|
skill_name * | string | Name of the skill to activate (e.g. lsp-rename, lsp-refactor, lsp-safe-edit, lsp-verify) |
mode | string | Enforcement mode: warn (log violations but allow) or block (return error with recovery guidance). Default: warn |
add_workspace_folder
Add a directory to the LSP workspace, enabling cross-repo references, definitions, and diagnostics. Useful when working across a library and its consumers — after adding the consumer repo, find_references on a library function returns call sites in both repos. Requires start_lsp to have been called first. Language servers that support multi-root workspaces (gopls, rust-analyzer, typescript-language-server) will re-index the new folder automatically.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to the workspace folder to add/remove |
apply_edit
Apply an edit to a file. Two modes: (1) WorkspaceEdit mode: pass workspace_edit with positional changes returned by rename_symbol or format_document; (2) Text-match mode: pass file_path + old_text + new_text to find and replace text. For full function/method body replacements, consider replace_symbol_body which resolves by symbol name instead of text matching. Always call preview_edit first to verify the edit is safe.
| Parameter | Type | Description |
|---|---|---|
file_path | string | File path for text-match mode |
new_text | string | Replacement text (text-match mode) |
old_text | string | Text to find and replace (text-match mode) |
workspace_edit | object | WorkspaceEdit object (as returned by rename_symbol or format_document) |
blast_radius
Enumerate all exported symbols in the specified files, resolve their references across the workspace, and partition callers into test vs non-test. Returns affected_symbols (name, file, line), test_callers (with enclosing test function names), and non_test_callers. Use before editing a file to understand blast radius. Set include_transitive=true to surface second-order callers (callers of callers). Set scope='all' to include unexported symbols for comprehensive dead code detection.
| Parameter | Type | Description |
|---|---|---|
changed_files * | array | List of absolute file paths to analyze for exported symbol impact |
filter | string | Filter results: 'untested' returns only symbols with production callers but zero test callers |
include_transitive | boolean | If true, include second-order callers (callers of callers) in the results |
scope | string | Symbol scope: 'exported' (default) or 'all' (includes unexported symbols for dead code detection) |
callers
Find all incoming callers of a function or method. Shortcut for find_callers with direction='incoming'. Use before deleting or refactoring a function to see who depends on it.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
cross_concurrent | boolean | If true\, annotate callers that cross concurrent boundaries (goroutines\, threads\, async tasks). Returns concurrent_callers with the detected pattern. |
direction | string | Direction: incoming\, outgoing\, or both (default: both) |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |
close_document
Close a file in the LSP server. Use this tool when you're done with a file to free up resources and reduce memory usage. It's good practice to close files that are no longer being actively analyzed, especially in long-running sessions or when working with large codebases.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the file to close |
commit_session
Commit a simulation session. With apply=true, writes changes to disk and notifies LSP servers. With apply=false, returns a unified diff patch. Use after evaluate_session confirms the changes are safe.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Session identifier returned by create_simulation_session |
apply | boolean | If true, write changes to disk and notify LSP. If false, return diff only |
target | string | Commit target: disk (write files) or patch (return unified diff). Default: patch |
create_simulation_session
Create a new speculative code session for simulating edits without committing to disk. Returns a session ID. Baseline diagnostics are captured lazily on first edit per file. Use this to explore what-if scenarios before applying changes.
| Parameter | Type | Description |
|---|---|---|
language * | string | Language identifier for the session (e.g. go, typescript) |
workspace_root * | string | Workspace root directory for the simulation session |
deactivate_skill
Deactivate phase enforcement for the currently active skill. Tool calls will no longer be checked against phase permissions. Call this when the skill workflow is complete or when you need to exit the workflow early.
destroy_session
Destroy a simulation session and release all resources. Call this after commit or discard to clean up. Sessions in terminal states (committed, discarded, destroyed) cannot be reused.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Session identifier returned by create_simulation_session |
detect_changes
Run git diff to identify changed files, analyze their exported symbols via blast_radius, and return affected symbols with risk classification. Risk levels: 'high' (callers from multiple packages), 'medium' (callers from same package only), 'low' (zero non-test callers). Use before committing to understand the blast radius of uncommitted or recently committed changes.
| Parameter | Type | Description |
|---|---|---|
range | string | Git range for 'committed' scope. Examples: 'v0.7.0..HEAD', 'abc123..def456', 'main'. If a single ref is given, compares ref~1..ref. Ignored for unstaged/staged scopes. |
scope | string | Which changes to analyze: 'unstaged' (default), 'staged', or 'committed' |
workspace_root | string | Absolute path to the git repository root. Defaults to the LSP workspace root if omitted |
detect_lsp_servers
Scan a workspace directory for source languages and check PATH for the corresponding LSP server binaries. Returns detected workspace languages (ranked by prevalence), installed servers with their paths, and a suggested_config array ready to paste into the agent-lsp MCP server args. Use this to set up agent-lsp for a new project or verify your configuration.
| Parameter | Type | Description |
|---|---|---|
workspace_dir * | string | Directory to scan for source languages and LSP server binaries |
did_change_watched_files
Notify the language server that files have changed on disk outside the editor (workspace/didChangeWatchedFiles). Use this after writing files directly to disk so the server refreshes its caches. Change types: 1=created, 2=changed, 3=deleted. File URIs must use the file:/// scheme.
| Parameter | Type | Description |
|---|---|---|
changes * | array | Array of file change events: [{uri\, type}] where type is 1=created\, 2=changed\, 3=deleted |
discard_session
Discard a simulation session and revert all in-memory changes by restoring baseline content. Use when simulation results show the changes would introduce errors.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Session identifier returned by create_simulation_session |
evaluate_session
Evaluate a simulation session by comparing current diagnostics against baselines. Returns errors introduced, errors resolved, net delta, and confidence (high for file scope, eventual for workspace). Use after simulate_edit to assess impact before committing.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Session identifier returned by create_simulation_session |
scope | string | Evaluation scope: file (fast, single file) or workspace (full, all files). Default: file |
timeout_ms | integer | Timeout in milliseconds for LSP diagnostics collection. Default: 3000 for file scope\, 8000 for workspace scope |
execute_command
Execute a workspace command via LSP. Commands are server-defined identifiers returned by code actions (in the command field of a CodeAction). Use this after suggest_fixes to trigger a server-side operation such as applying a refactoring, generating code, or running a server-specific action. Returns the server-defined result or null.
| Parameter | Type | Description |
|---|---|---|
command * | string | LSP command identifier (from code action's command field) |
arguments | array | Command arguments: an array of JSON values (objects\, strings\, numbers\, ...)\, passed to the server as is |
explore
Deep exploration of a symbol: combines type info, source, callers, references, and test callers in one call. Use when navigating unfamiliar code and you need the full picture of what a symbol is and how it is used.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the source file |
column | integer | 1-indexed column (character offset) in the line. Optional when position_pattern is provided. |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
line | integer | 1-indexed line number in the file. Optional when position_pattern is provided. |
position_pattern | string | Alternative to line/column: use @@pattern@@ syntax to match text near the target position |
explore_symbol
Deep-dive into a symbol: type info, source code, callers (top 10), references (count + top 5 files), and test caller count in one call. Use when you need full context about a symbol before editing. Accepts file_path + line/column or position_pattern.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the source file |
column | integer | 1-indexed column (character offset) in the line. Optional when position_pattern is provided. |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |
line | integer | 1-indexed line number in the file. Optional when position_pattern is provided. |
position_pattern | string | Alternative to line/column: use @@pattern@@ syntax to match text near the target position |
export_cache
Export the symbol reference cache as a gzip-compressed artifact for team sharing. The exported file can be committed to the repository (e.g. .agent-lsp/cache.db.gz) so teammates skip cold-start indexing. Requires start_lsp to have been called first.
| Parameter | Type | Description |
|---|---|---|
dest_path * | string | Destination path for the compressed cache artifact (e.g. .agent-lsp/cache.db.gz) |
find_callers
Find what calls this function and what it calls. Returns incoming callers, outgoing callees, or both (default). Use before deleting or refactoring a function to understand its role in the call graph. Works on functions and methods only; for types, use find_references instead.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
cross_concurrent | boolean | If true\, annotate callers that cross concurrent boundaries (goroutines\, threads\, async tasks). Returns concurrent_callers with the detected pattern. |
direction | string | Direction: incoming\, outgoing\, or both (default: both) |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |
find_references
Find all usages of a symbol across the codebase. Use before renaming, deleting, or changing any symbol to understand who calls it. Zero references means the symbol may be dead code; use safe_delete_symbol to remove it safely. For blast-radius analysis with test/non-test partitioning, use blast_radius instead.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the source file |
column | integer | 1-indexed column (character offset) in the line. Optional when position_pattern is provided. |
include_declaration | boolean | Whether to include the declaration site in the results |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
line | integer | 1-indexed line number in the file. Optional when position_pattern is provided. |
position_pattern | string | Alternative to line/column: use @@pattern@@ syntax to match text near the target position |
find_symbol
Search for a symbol by name across the entire workspace. Returns matching symbols with name, kind, file, and location. Use when you know a symbol's name but not its file. Use detail_level: "hover" to also get type signatures and docs for each match.
| Parameter | Type | Description |
|---|---|---|
detail_level | string | Enrichment level: 'basic' for names/locations only, 'hover' to include type signatures and docs |
limit | integer | Maximum number of symbols to enrich with hover info (default 3) |
offset | integer | Number of symbols to skip before enriching (default 0), for pagination |
query | string | Symbol name or pattern to search for across the workspace |
format_document
Get formatting edits for a file via LSP. Returns TextEdit[] for inspection (not applied automatically). Apply via apply_edit. Formats one file at a time; to find which files need formatting, use your shell (e.g. gofmt -l ./...).
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the file to format |
insert_spaces | boolean | Use spaces instead of tabs. Default: true |
language_id | string | |
tab_size | integer | Tab size in spaces. Default: 2 |
format_range
Get formatting edits for a specific range within a document via LSP (textDocument/rangeFormatting). Returns TextEdit[] for the selected lines/characters only. Use this when you want to format a function, block, or selection rather than the entire file. The edits are NOT applied automatically.
| Parameter | Type | Description |
|---|---|---|
end_column * | integer | 1-indexed end column of the range to format |
end_line * | integer | 1-indexed end line of the range to format |
file_path * | string | Absolute path to the file to format |
start_column * | integer | 1-indexed start column of the range to format |
start_line * | integer | 1-indexed start line of the range to format |
insert_spaces | boolean | Use spaces instead of tabs. Default: true |
language_id | string | |
tab_size | integer | Tab size in spaces. Default: 2 |
get_completions
Get completion suggestions at a specific location in a file. Use this tool to retrieve code completion options based on the current context, including variable names, function calls, object properties, and more. Helpful for code assistance and auto-completion at a particular location. Use this when determining which functions you have available in a given package, for example when changing libraries.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
get_cross_repo_references
Find all references to a library symbol across one or more consumer repositories. Adds each consumer_root as a workspace folder, waits for indexing, then calls find_references and partitions results by repo. Returns library_references (within the primary repo), consumer_references (map of root → locations), and warnings (roots that could not be indexed). Use before changing a shared library API to find all downstream callers.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) of the symbol in the line |
consumer_roots * | array | List of absolute paths to consumer repository roots to search for references |
line * | integer | 1-indexed line number of the symbol in the file |
symbol_file * | string | Absolute path to the file containing the symbol to search for |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
get_diagnostics
Get diagnostic messages (errors, warnings) for files. Use this tool to identify problems in code files such as syntax errors, type mismatches, or other issues detected by the language server. When used without a file_path, returns diagnostics for all open files.
| Parameter | Type | Description |
|---|---|---|
file_path | string | File path to get diagnostics for. If omitted, returns diagnostics for all open files |
group_by | string | Set to 'symbol' to group diagnostics by their owning symbol. Returns symbols with their diagnostics instead of a flat list. Helps understand which function or type is broken. |
get_document_highlights
Find all occurrences of the symbol at a position within the same file via LSP (textDocument/documentHighlight). Returns ranges and kinds: 1=Text, 2=Read, 3=Write. File-scoped and instant — does not trigger a workspace-wide reference search. Use this to find all local usages of a variable, parameter, or field without the overhead of find_references.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |
get_inlay_hints
Get inlay hints for a range within a document via LSP (textDocument/inlayHint). Inlay hints are inline annotations that IDEs display in source code — typically inferred type names (e.g. `: string`) and parameter name labels (e.g. `count:`). Useful in languages with type inference (TypeScript, Rust, Go) to see what the compiler knows without reading every type annotation. Returns an array of InlayHint objects, each with a position, label, and optional kind (1=Type, 2=Parameter). Returns an empty array if the language server does not support inlay hints.
| Parameter | Type | Description |
|---|---|---|
end_column * | integer | 1-indexed end column of the range |
end_line * | integer | 1-indexed end line of the range |
file_path * | string | Absolute path to the source file |
start_column * | integer | 1-indexed start column of the range |
start_line * | integer | 1-indexed start line of the range |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
get_semantic_tokens
Get semantic tokens for a range in a file. Returns each token's type (function, variable, keyword, parameter, type, etc.) and modifiers (readonly, static, deprecated, etc.) with 1-based line/character positions. Use this to understand the syntactic role of code elements — distinct from hover which gives documentation. Only available when the language server supports textDocument/semanticTokens.
| Parameter | Type | Description |
|---|---|---|
end_column * | integer | 1-indexed end column of the range |
end_line * | integer | 1-indexed end line of the range |
file_path * | string | Absolute path to the source file |
start_column * | integer | 1-indexed start column of the range |
start_line * | integer | 1-indexed start line of the range |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
get_server_capabilities
Return the language server's capability map and classify every agent-lsp tool as supported or unsupported based on what the server advertised during initialization. Use this to determine which tools will return results before calling them — saves round trips on servers that don't support certain LSP features (e.g. not all servers support type_hierarchy or inlay_hints). Requires start_lsp to have been called first.
get_signature_help
Get function signature help at a specific location in a file via LSP. Returns available overloads and highlights the active parameter. Use this when the cursor is inside a function call's argument list to understand what parameters the function expects.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
get_skill_phase
Get the current state of skill phase enforcement: active skill, current phase, allowed and forbidden tools, and tool call history. Use this to understand where you are in a skill workflow and what tools are available.
get_symbol_documentation
Fetch authoritative documentation for a named symbol from local toolchain sources (go doc, pydoc, cargo doc) without requiring an LSP hover response. Works on transitive dependencies not indexed by the language server. Returns the full doc text, extracted signature, and source tag. Falls back gracefully when the toolchain command fails or the language is unsupported.
| Parameter | Type | Description |
|---|---|---|
language_id * | string | Language identifier (e.g. go, python, rust) to select the correct toolchain doc command |
symbol * | string | Fully qualified symbol name to look up (e.g. 'fmt.Println', 'os.File.Read') |
file_path | string | Optional file path to establish workspace context for the documentation lookup |
format | string | Output format for the documentation (e.g. 'markdown', 'plain') |
get_symbol_source
Return the source code of the innermost symbol (function, method, class, struct, etc.) whose range contains the given cursor position. Calls textDocument/documentSymbol, walks the symbol tree to find the smallest enclosing symbol, then slices the file at that symbol's range. Returns symbol_name, symbol_kind, start_line (1-based), end_line (1-based), and source text. Use line+character or position_pattern (@@-syntax) to specify the cursor. character defaults to 1.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the source file |
column | integer | 1-indexed column (character offset) in the line (defaults to 1) |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
line | integer | 1-indexed line number of the cursor position |
position_pattern | string | Alternative to line/column: use @@pattern@@ syntax to match text near the target position |
get_tests_for_file
Given a source file path, return the test files that exercise it. Static lookup — no test execution. Go: *_test.go in same directory. Python: test_*.py / *_test.py in same dir and tests/ sibling. TypeScript/JS: *.test.ts, *.spec.ts etc. Rust: returns source file itself (tests inline). Does not require start_lsp.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Source file path to find associated test files for |
go_to_declaration
Jump to the declaration of a symbol at a specific location in a file via LSP. Completes the 'go to X' family alongside go_to_definition, go_to_type_definition, and go_to_implementation. Most useful for languages with separate declaration and definition (e.g., C/C++ header files). Returns the file path and position where the symbol is declared.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |
go_to_definition
Jump to the definition of a symbol at a specific location in a file via LSP. Returns the file path and position where the symbol is defined. Useful for navigating to type declarations, function implementations, or variable assignments across the codebase.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |
position_pattern | string | Alternative to line/column: use @@pattern@@ syntax to match text near the target position |
go_to_implementation
Find all implementations of an interface or abstract method at a specific location in a file via LSP. Returns the file paths and positions of all concrete implementations. Use this to navigate from an interface declaration or abstract method to the concrete classes that implement it.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |
go_to_symbol
Navigate to a symbol definition by dot-notation name (e.g. "LSPClient.GetReferences", "http.Handler") without needing file_path or line/column. Uses workspace symbol search to locate the definition. Useful when you know the symbol name but not its location.
| Parameter | Type | Description |
|---|---|---|
symbol_path * | string | Dot-notation symbol path (e.g. MyStruct.MyMethod\, http.Handler) |
language | string | Language filter for symbol search. Optional |
workspace_root | string | Workspace root directory for symbol search. Optional; uses current workspace |
go_to_type_definition
Jump to the definition of the type of a symbol at a specific location in a file via LSP. Unlike go_to_definition (which goes to where the symbol itself is defined), this navigates to the type declaration. Useful for interface types, type aliases, and class definitions when working with instances or variables.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |
import_cache
Import a gzip-compressed cache artifact, replacing the current symbol reference cache. Use this to load a team-shared cache exported via export_cache. Validates database integrity after import. Requires start_lsp to have been called first.
| Parameter | Type | Description |
|---|---|---|
src_path * | string | Path to the compressed cache artifact to import |
insert_after_symbol
Insert code immediately after a named symbol definition. Resolves the symbol's end position via document symbols. Use for adding new methods after existing ones, appending related functions, etc.
| Parameter | Type | Description |
|---|---|---|
code * | string | Code to insert after the symbol definition |
file_path * | string | Absolute path to the source file |
symbol_path * | string | Dot-notation symbol path to insert after |
language_id | string | Language identifier. Optional; auto-detected |
insert_before_symbol
Insert code immediately before a named symbol definition. Resolves the symbol's start position via document symbols. Use for adding imports, comments, decorators, or type definitions before their first consumer.
| Parameter | Type | Description |
|---|---|---|
code * | string | Code to insert before the symbol definition |
file_path * | string | Absolute path to the source file |
symbol_path * | string | Dot-notation symbol path to insert before |
language_id | string | Language identifier. Optional; auto-detected |
inspect_symbol
Get type information, documentation, and signature for a symbol at a specific location. Use this to understand what a function does, what type a variable has, or what a module exports before editing it. For finding all usages of the symbol, use find_references instead.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the source file |
column | integer | 1-indexed column (character offset) in the line. Optional when position_pattern is provided. |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
line | integer | 1-indexed line number in the file. Optional when position_pattern is provided. |
position_pattern | string | Alternative to line/column: use @@pattern@@ syntax to match text near the target position |
list_symbols
List all symbols defined in a file (functions, types, methods, variables). Returns a hierarchical tree showing the file's structure. Use to get an overview before editing, or to find the exact name of a symbol for use with replace_symbol_body or find_references. Pass format: "outline" for compact markdown output optimized for LLM consumption.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the source file |
format | string | Output format: 'outline' for compact markdown, default returns JSON |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
list_workspace_folders
List all currently active workspace folders. Use this to see which roots the language server is indexing.
open_document
Open a file in the LSP server for analysis. Use this tool before performing operations like getting diagnostics, hover information, or completions for a file. The file remains open for continued analysis until explicitly closed. The language_id parameter tells the server which language service to use (e.g., 'typescript', 'javascript', 'haskell'). The LSP server starts automatically on MCP launch.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the file to open in the LSP server |
language_id | string | |
text | string | Optional file content override. If omitted, reads from disk |
prepare_rename
Validate that a rename is possible at the given position before committing to rename_symbol. Returns the range that would be renamed and a placeholder name suggestion, or a message indicating rename is not supported at this position. Use this before rename_symbol to avoid attempting invalid renames. Returns null if the server does not support prepareRename.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |
preview_edit
Preview the impact of an edit before writing to disk. Shows what errors would be introduced or resolved without touching the file. If net_delta is 0, the edit is safe to apply without further verification. Use before every apply_edit to catch problems early. All line/column positions are 1-indexed. For full function replacements, consider replace_symbol_body instead of apply_edit.
| Parameter | Type | Description |
|---|---|---|
end_column * | integer | 1-indexed end column of the range to replace |
end_line * | integer | 1-indexed end line of the range to replace |
file_path * | string | Absolute path to the file to edit within the session |
new_text * | string | Replacement text for the specified range |
start_column * | integer | 1-indexed start column of the range to replace |
start_line * | integer | 1-indexed start line of the range to replace |
language | string | Language identifier for the session (e.g. go, typescript) |
scope | string | Evaluation scope: file (fast, single file) or workspace (full, all files). Default: file |
session_id | string | Session identifier returned by create_simulation_session |
timeout_ms | integer | Timeout in milliseconds for LSP diagnostics collection. Default: 3000 for file scope\, 8000 for workspace scope |
workspace_root | string | Workspace root directory for the simulation session |
refactor
Run a language server refactoring at a position: implement an interface, add or remove struct tags, extract to a new file, move a declaration, and others the server offers there. Call without action to list the refactorings at the position (pass end_line/end_column to select a range, e.g. struct fields). Call with action to run one. Refactorings that need input (gopls v0.24+ interactive refactorings) return status needs_input with their questions: field ids, kinds, options and defaults; call again with answers {field id: value}, and option_queries to search a lazyEnum field's options. Rejected…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the source file |
action | string | Title of the refactoring to run (from the list this tool returns without action). Omit to list the refactorings available at the position |
answers | object | Answers to the refactoring's questions: {field id: value}. Returned questions list the field ids\, kinds\, options and defaults |
column | integer | 1-indexed column (start of the selection) |
dry_run | boolean | If true\, return the edit without writing it |
end_column | integer | 1-indexed end column of the selection |
end_line | integer | 1-indexed end line of the selection. Some refactorings need one (e.g. select struct fields to add tags) |
language_id | string | Language identifier (e.g. go\, typescript). Optional; auto-detected from file extension |
line | integer | 1-indexed line of the code to refactor (start of the selection) |
option_queries | object | Search text for searchable fields (kind lazyEnum): {field id: query}\, to narrow the options returned |
position_pattern | string | Alternative to line/column: @@pattern@@ syntax matching text at the position |
remove_workspace_folder
Remove a directory from the LSP workspace. The language server will stop indexing that folder.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to the workspace folder to add/remove |
rename_symbol
Rename a symbol across the entire workspace via LSP and write the edits to disk. Use dry_run=true first to preview the changes without writing them (files, locations, and the edit). Call find_references before renaming exported symbols to understand blast radius. The result reports diagnostics for the renamed file after the edit; call get_diagnostics on other affected files to confirm no errors were introduced.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the source file |
new_name * | string | New name for the symbol |
column | integer | 1-indexed column (character offset) in the line |
dry_run | boolean | If true\, return the edit as a preview without writing it |
exclude_globs | array | Glob patterns for files to exclude from rename (e.g. vendor/**\, *_gen.go) |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |
line | integer | 1-indexed line number in the file |
position_pattern | string | Alternative to line/column: use @@pattern@@ syntax to match text near the target position |
replace_symbol_body
Replace the body of a named symbol (function, method, class) by dot-notation path, preserving the declaration/signature line. Resolves the symbol via document symbols without requiring line/column positions. Use symbol_path like 'MyStruct.Method' or 'Function'. For overload disambiguation, append [N] index (e.g. 'Handle[1]').
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the source file |
new_body * | string | New body text to replace the symbol's body (signature/declaration preserved) |
symbol_path * | string | Dot-notation symbol path (e.g. MyStruct.Method, Function, Method[0] for overload disambiguation) |
language_id | string | Language identifier. Optional; auto-detected |
restart_lsp_server
Restart the LSP server process. Use this if the LSP server becomes unresponsive or after making significant changes to the project structure. Optionally provide a new root_dir to restart with a different workspace root.
| Parameter | Type | Description |
|---|---|---|
root_dir | string | Optional new workspace root. If omitted, restarts with current root |
run_build
Compile the project at workspace_dir using the detected workspace language. Language-specific dispatch (no arbitrary shell execution): go build ./..., cargo build, tsc --noEmit, mypy . (Python typecheck proxy). Optional path param narrows scope. Returns: { success: bool, errors: [{file, line, column, message}], raw: string }. Does not require start_lsp.
| Parameter | Type | Description |
|---|---|---|
workspace_dir * | string | Workspace directory to build |
language | string | Optional language override (go\, rust\, typescript\, python) |
path | string | Optional sub-path to narrow build scope |
run_tests
Run the test suite for the detected workspace language. Language-specific dispatch: go test -json ./..., cargo test --message-format=json, pytest --tb=json, npm test. Optional path param narrows scope. Test failure locations are LSP-normalized — paste directly into go_to_definition. Returns: { passed: bool, failures: [{file, line, test_name, message, location}], raw: string }. Does not require start_lsp.
| Parameter | Type | Description |
|---|---|---|
workspace_dir * | string | Workspace directory to test |
language | string | Optional language override (go\, rust\, typescript\, python) |
path | string | Optional sub-path to narrow test scope |
safe_apply_edit
Preview an edit and apply it only if safe (net_delta == 0). Combines preview_edit + apply_edit into one call. If the edit would introduce errors (net_delta > 0), returns the preview result with applied=false so you can decide.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the file to edit |
new_text * | string | Replacement text |
old_text * | string | Exact text to find and replace |
safe_delete_symbol
Delete a named symbol only if it has zero references across the workspace (verified via LSP references before deletion). Returns an error with the caller count if the symbol is still in use. Prevents accidental removal of active code.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the source file |
symbol_path * | string | Dot-notation symbol path of the symbol to delete |
language_id | string | Language identifier. Optional; auto-detected |
safe_edit
Preview an edit and apply it only if safe (net diagnostic delta == 0). Combines preview_edit + apply_edit into one step. Returns applied=true on success or applied=false with preview diagnostics when the edit would introduce errors.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | Absolute path to the file to edit |
new_text * | string | Replacement text |
old_text * | string | Exact text to find and replace |
set_log_level
Set the server logging level. Use this tool to control the verbosity of logs generated by the LSP MCP server. Available levels from least to most verbose: emergency, alert, critical, error, warning, notice, info, debug. Increasing verbosity can help troubleshoot issues but may generate large amounts of output.
| Parameter | Type | Description |
|---|---|---|
level * | string | Log level: emergency\, alert\, critical\, error\, warning\, notice\, info\, or debug |
simulate_chain
Apply a sequence of edits and evaluate after each step. Returns per-step diagnostics and identifies the safe-to-apply-through step (last step with net delta == 0). Use this to find the safest partial application of a multi-step change. All line/column positions in each edit are 1-indexed.
| Parameter | Type | Description |
|---|---|---|
edits * | array | Array of edit objects, each with file_path, start_line, start_column, end_line, end_column, new_text |
session_id * | string | Session identifier returned by create_simulation_session |
timeout_ms | integer | Timeout in milliseconds for LSP diagnostics collection. Default: 3000 for file scope\, 8000 for workspace scope |
simulate_edit
Apply a range edit to a file within a simulation session. Changes are held in-memory only. The session captures baseline diagnostics on first edit to each file, then tracks versions for subsequent edits. Returns the new version number after the edit. All line/column positions are 1-indexed (matching editor line numbers).
| Parameter | Type | Description |
|---|---|---|
end_column * | integer | 1-indexed end column of the range to replace |
end_line * | integer | 1-indexed end line of the range to replace |
file_path * | string | Absolute path to the file to edit within the session |
new_text * | string | Replacement text for the specified range |
session_id * | string | Session identifier returned by create_simulation_session |
start_column * | integer | 1-indexed start column of the range to replace |
start_line * | integer | 1-indexed start line of the range to replace |
start_lsp
Initialize or reinitialize the LSP server with a specific project root directory. Call this before using find_references, inspect_symbol, or get_diagnostics when working in a project different from the one the server was started with. root_dir should be the workspace root (directory containing go.mod, package.json, Cargo.toml, etc.). Optional language_id (e.g. "go", "typescript", "rust") selects a specific configured server in multi-server mode — use this when working in a mixed-language repo to ensure the correct server handles the workspace. If unsure which server is active, call get_serve…
| Parameter | Type | Description |
|---|---|---|
root_dir * | string | Workspace root directory containing the project (e.g. directory with go.mod, package.json) |
connect | string | Connect to an already-running language server at this TCP address (e.g. localhost:9999) instead of spawning a new process. Reuses the existing server's warm index. Supported by gopls (gopls -listen=:9… |
language_id | string | Language server to start (e.g. go, typescript, rust). Optional; auto-detected |
ready_timeout_seconds | number | If > 0, block until all $/progress workspace-indexing tokens complete or this many seconds elapse. Useful for servers like jdtls that index asynchronously after initialize. |
scope | string | Limit indexing to specific subdirectories. Accepts a path string or array of paths relative to root_dir. Generates a temporary language-server config (pyrightconfig.json, tsconfig.json) that restricts… |
suggest_fixes
Get available quick fixes and code actions for a diagnostic or code range. Returns actionable fixes (add missing import, implement interface, fix type error) that can be applied via apply_edit. To auto-fix all diagnostics in a file, use the /lsp-fix-all skill via prompts/get.
| Parameter | Type | Description |
|---|---|---|
end_column * | integer | 1-indexed end column of the range |
end_line * | integer | 1-indexed end line of the range |
file_path * | string | Absolute path to the source file |
start_column * | integer | 1-indexed start column of the range |
start_line * | integer | 1-indexed start line of the range |
language_id | string | Language identifier (e.g. go, typescript, python). Optional; auto-detected from file extension |
type_hierarchy
Show type hierarchy for a type at a position. Returns supertypes (parent classes/interfaces), subtypes (subclasses/implementations), or both depending on the direction parameter. Direction defaults to "both". Use this to understand class and interface inheritance relationships.
| Parameter | Type | Description |
|---|---|---|
column * | integer | 1-indexed column (character offset) in the line |
file_path * | string | Absolute path to the source file |
line * | integer | 1-indexed line number in the file |
direction | string | Direction: supertypes\, subtypes\, or both (default: both) |
language_id | string | Language identifier (e.g. go\, typescript\, python). Optional; auto-detected from file extension |