javalens-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| JAVA_PROJECT_PATH | No | Auto-load project on startup | |
| JAVA_TOOL_OPTIONS | No | JVM options, e.g. -Xmx2g for large projects | |
| JAVALENS_LOG_LEVEL | No | TRACE/DEBUG/INFO/WARN/ERROR | INFO |
| JAVALENS_TIMEOUT_SECONDS | No | Operation timeout | 30 |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| health_checkA | Check server status and project state. USAGE: Call on startup to verify server is operational. OUTPUT: Server status, project info if loaded, capabilities. WORKFLOW:
|
| load_projectA | Load a Java project for analysis. MUST be called before using other analysis tools. USAGE: load_project(projectPath="/path/to/project") OUTPUT: Project structure summary including packages, source files, build system Supports:
WORKFLOW:
|
| search_symbolsA | Search for types, methods, fields by name pattern. Supports glob patterns: * (any chars), ? (single char) USAGE: search_symbols(query="*Service", kind="Class") OUTPUT: List of matching symbols with locations EXAMPLES:
PAGINATION: Use offset parameter for large result sets IMPORTANT: Requires load_project to be called first. |
| go_to_definitionA | Navigate to symbol definition. USAGE: Position cursor on a symbol reference, returns definition location. OUTPUT: File path, line, column of the definition. IMPORTANT: Uses ZERO-BASED coordinates. If editor shows 'Line 14, Column 5', pass line=13, column=4 Requires load_project to be called first. |
| find_referencesA | Find all references to a symbol across the project. USAGE: Position on symbol, find all usages OUTPUT: List of reference locations with context IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| find_implementationsA | Find implementations of an interface or extensions of a class. USAGE: Position on a type (interface or class), find all implementors/subclasses OUTPUT: List of implementing/extending types with locations IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_type_hierarchyA | Get the type hierarchy (supertypes and subtypes) for a Java type. USAGE: Position on a type, returns full inheritance chain OUTPUT: Superclasses, interfaces, and all subtypes Can be called with either:
IMPORTANT: Uses ZERO-BASED coordinates when using file position. Requires load_project to be called first. |
| get_document_symbolsA | Get all symbols (types, methods, fields) in a source file. USAGE: Provide a file path to get all symbols in that file OUTPUT: Hierarchical list of all types, methods, fields, and nested types Returns symbols with their locations, kinds, and modifiers. Requires load_project to be called first. |
| get_type_membersA | Get all members (methods, fields, nested types) of a specific type. USAGE: Provide a type name to get all its members OUTPUT: Lists of methods, fields, and nested types with their details Options:
Requires load_project to be called first. |
| get_classpath_infoA | Get project classpath information. USAGE: Call to get all classpath entries for the loaded project OUTPUT: Source folders, libraries, and classpath containers Useful for understanding project structure and dependencies. Requires load_project to be called first. |
| get_project_structureA | Get project structure showing package hierarchy. USAGE: Call to see the package tree of the loaded project OUTPUT: Source roots with packages and file counts Requires load_project to be called first. |
| get_symbol_infoA | Get detailed information about any symbol at a position. USAGE: Position on any symbol (type, method, field, variable) OUTPUT: Comprehensive info including kind, modifiers, signature, location IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_type_at_positionA | Get type information at a specific position. USAGE: Position on a type reference or declaration OUTPUT: Type details including kind, modifiers, superclass, interfaces IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_method_at_positionA | Get method information at a specific position. USAGE: Position on a method reference or declaration OUTPUT: Method signature, parameters, return type, modifiers, exceptions IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_field_at_positionA | Get field information at a specific position. USAGE: Position on a field reference or declaration OUTPUT: Field type, modifiers, constant value if applicable IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_hover_infoA | Get hover information (documentation) for a symbol at a position. USAGE: Position on any symbol OUTPUT: Signature, Javadoc, and quick info similar to IDE hover IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_javadocA | Get parsed Javadoc documentation for a symbol. USAGE: Position on any documented symbol OUTPUT: Parsed Javadoc with summary, @param, @return, @throws, etc. IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_signature_helpA | Get method signature help at a position. USAGE: Position on a method call or declaration OUTPUT: Method signatures with parameter info IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_enclosing_elementA | Get the enclosing element at a position. USAGE: Position anywhere in code OUTPUT: Enclosing method, type, and package info IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_super_methodA | Find the method that this method overrides or implements. USAGE: Position on a method that overrides/implements another OUTPUT: The superclass/interface method being overridden IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_diagnosticsA | Get compilation diagnostics (errors and warnings) for a file or project. USAGE: get_diagnostics() for all files, or get_diagnostics(filePath="...") for one file OUTPUT: List of compilation errors and warnings with locations Useful for finding syntax errors, type mismatches, missing imports, etc. Requires load_project to be called first. |
| validate_syntaxA | Quick syntax-only validation for a file or inline code. USAGE: validate_syntax(filePath="...") or validate_syntax(content="...") OUTPUT: Syntax errors (no semantic analysis for speed) Much faster than get_diagnostics - use for quick syntax checks. Requires load_project to be called first. |
| get_call_hierarchy_incomingA | Find all callers of a method (incoming calls). USAGE: Position cursor on a method name OUTPUT: List of methods that call this method IMPORTANT: Uses ZERO-BASED coordinates. Useful for understanding who depends on a method before changing it. Requires load_project to be called first. |
| get_call_hierarchy_outgoingA | Find all methods called by a method (outgoing calls). USAGE: Position cursor on a method name OUTPUT: List of methods that this method calls IMPORTANT: Uses ZERO-BASED coordinates. Useful for understanding what a method depends on. Requires load_project to be called first. |
| find_field_writesA | Find all write accesses (mutations) to a field. USAGE: Position cursor on a field declaration or reference OUTPUT: List of locations where the field is modified IMPORTANT: Uses ZERO-BASED coordinates. Unlike find_references which returns all usages, this returns only locations where the field value is changed (assignments, increments, etc). Useful for data flow analysis and understanding state mutations. Requires load_project to be called first. |
| find_testsA | Find test classes and methods in the project. USAGE: find_tests() OUTPUT: List of test classes with their test methods Supports:
Requires load_project to be called first. |
| find_unused_codeA | Find unused private methods and fields in the project. USAGE: find_unused_code() USAGE: find_unused_code(filePath="path/to/File.java") OUTPUT: List of unused private members Detects:
Requires load_project to be called first. |
| find_possible_bugsA | Find possible bugs and code quality issues. USAGE: find_possible_bugs() USAGE: find_possible_bugs(filePath="path/to/File.java") OUTPUT: List of potential issues Detects:
Requires load_project to be called first. |
| rename_symbolA | Rename a symbol (variable, method, field, class, etc.) across the project. Returns text edits for all occurrences that need to be changed. The caller should apply these edits to perform the rename. USAGE: Position on symbol, provide new name OUTPUT: List of text edits to apply IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| organize_importsA | Organize imports in a Java file. Removes unused imports and sorts remaining imports alphabetically. Returns the organized import block that should replace the existing imports. USAGE: organize_imports(filePath="path/to/File.java") OUTPUT: Organized import statements and list of changes Requires load_project to be called first. |
| extract_variableA | Extract an expression at the given position into a local variable. Returns the text edits needed to extract the expression. The caller should apply these edits to perform the extraction. USAGE: Select expression by providing start and end positions OUTPUT: Variable declaration and replacement edits IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| extract_methodA | Extract a code block into a new method. USAGE: Select code range, provide method name OUTPUT: Text edits for method declaration and call site The tool analyzes the selected code to:
IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| find_annotation_usagesA | Find all usages of an annotation type in the project. JDT-UNIQUE: This fine-grained search is not available in LSP. USAGE: Provide fully qualified annotation name OUTPUT: All locations where the annotation is applied Examples:
Requires load_project to be called first. |
| find_type_instantiationsA | Find all instantiations of a type (new Foo() calls). JDT-UNIQUE: This fine-grained search is not available in LSP. USAGE: Provide fully qualified type name OUTPUT: All locations where the type is instantiated with 'new' Useful for:
Requires load_project to be called first. |
| find_castsA | Find all casts to a type ((Foo) x expressions). JDT-UNIQUE: This fine-grained search is not available in LSP. USAGE: Provide fully qualified type name OUTPUT: All locations where casting to this type occurs Useful for:
Requires load_project to be called first. |
| find_instanceof_checksA | Find all instanceof checks for a type (x instanceof Foo). JDT-UNIQUE: This fine-grained search is not available in LSP. USAGE: Provide fully qualified type name OUTPUT: All locations where instanceof checks against this type occur Useful for:
Requires load_project to be called first. |
| find_throws_declarationsA | Find all throws declarations of an exception type in method signatures. JDT-UNIQUE: This fine-grained search is not available in LSP. USAGE: Provide fully qualified exception type name OUTPUT: All methods that declare 'throws ExceptionType' Useful for:
Requires load_project to be called first. |
| find_catch_blocksA | Find all catch blocks for an exception type (catch(ExceptionType e)). JDT-UNIQUE: This fine-grained search is not available in LSP. USAGE: Provide fully qualified exception type name OUTPUT: All catch blocks that handle this exception type Useful for:
Requires load_project to be called first. |
| find_method_referencesA | Find all method reference expressions (Foo::bar lambda syntax). JDT-UNIQUE: This fine-grained search is not available in LSP. USAGE: Position on a method, or provide method details OUTPUT: All locations where the method is used as a method reference Useful for:
IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| find_type_argumentsA | Find all usages of a type as a generic type argument (List, Map<K, Foo>). JDT-UNIQUE: This fine-grained search is not available in LSP. USAGE: Provide fully qualified type name OUTPUT: All locations where the type is used as a generic argument Useful for:
Requires load_project to be called first. |
| analyze_fileA | Comprehensive file analysis in a single call. Combines:
Use this instead of multiple calls to get_document_symbols + get_diagnostics. Requires load_project to be called first. |
| analyze_typeA | Comprehensive type analysis in a single call. Combines:
Use this instead of multiple calls to get_type_members + get_type_hierarchy + get_type_usage_summary. Requires load_project to be called first. |
| analyze_methodA | Comprehensive method analysis in a single call. Combines:
Use this instead of multiple calls to get_method_at_position + call hierarchy tools. IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| get_type_usage_summaryA | Get comprehensive usage summary for a type across the codebase. Aggregates all usage patterns in a single call:
Use this to understand how a type is used throughout the project. Requires load_project to be called first. |
| extract_constantA | Extract an expression into a static final constant at class level. Returns the text edits needed to extract the expression. The caller should apply these edits to perform the extraction. USAGE: Select expression by providing start and end positions OUTPUT: Constant declaration and replacement edits IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| inline_variableA | Inline a local variable by replacing all usages with its initializer expression. Returns the text edits needed to inline the variable. The caller should apply these edits to perform the inlining. USAGE: Position cursor on variable declaration or usage OUTPUT: Edits to delete declaration and replace usages with initializer IMPORTANT: Uses ZERO-BASED coordinates. SAFETY: Will refuse if variable is modified after initialization. Requires load_project to be called first. |
| inline_methodA | Inline a method call by replacing it with the method body. Returns the text edit needed to inline the method call. The caller should apply this edit to perform the inlining. USAGE: Position cursor on a method call OUTPUT: Edit to replace call with method body IMPORTANT: Uses ZERO-BASED coordinates. LIMITATIONS:
Requires load_project to be called first. |
| change_method_signatureA | Change method signature (parameters, return type, or name) and update all call sites. Returns text edits for the method declaration and all call sites. The caller should apply these edits to perform the change. USAGE: Position on method declaration, provide changes OUTPUT: Edits for declaration and all call sites PARAMETER OPERATIONS:
IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| extract_interfaceA | Extract an interface from a class containing selected public methods. Returns the text for a new interface file and edits to add 'implements' clause to the original class. USAGE: Position on class, provide interface name, optionally specify methods OUTPUT: Interface file content and class modification edit IMPORTANT: Uses ZERO-BASED coordinates. Requires load_project to be called first. |
| convert_anonymous_to_lambdaA | Convert an anonymous class implementing a functional interface to a lambda expression. Returns the text edit needed to convert the anonymous class to a lambda. The caller should apply this edit to perform the conversion. USAGE: Position cursor on the 'new' keyword of the anonymous class OUTPUT: Edit to replace anonymous class with lambda IMPORTANT: Uses ZERO-BASED coordinates. REQUIREMENTS: The anonymous class must implement a functional interface (exactly one abstract method). Requires load_project to be called first. |
| suggest_importsA | Find import candidates for unresolved type. USAGE: suggest_imports(typeName="List") OUTPUT: List of matching types with fully qualified names and relevance Searches project sources, JDK, and libraries for types matching the simple name. Results are sorted by relevance (java.util types ranked higher than java.awt, etc.). Requires load_project to be called first. |
| get_quick_fixesA | List available fixes for a problem at position. USAGE: get_quick_fixes(filePath="...", line=10) OUTPUT: List of quick fixes with fixId, label, and category Supported fixes:
IMPORTANT: Uses ZERO-BASED line numbers. Requires load_project to be called first. |
| apply_quick_fixA | Apply a fix by ID. USAGE: apply_quick_fix(filePath="...", fixId="add_import:java.util.List") OUTPUT: Text edits to apply the fix Fix ID formats:
IMPORTANT: Uses ZERO-BASED line numbers. Requires load_project to be called first. |
| get_complexity_metricsA | Get cyclomatic complexity, cognitive complexity, LOC. USAGE: get_complexity_metrics(filePath="path/to/File.java") OUTPUT: Complexity metrics with risk assessment Metrics:
Risk levels:
Requires load_project to be called first. |
| get_dependency_graphA | Get package/type dependencies. USAGE: get_dependency_graph(scope="type", name="com.example.OrderService") USAGE: get_dependency_graph(scope="package", name="com.example.service") OUTPUT: Dependency graph with nodes and edges Dependency types tracked:
Requires load_project to be called first. |
| find_circular_dependenciesA | Detect cycles in packages. USAGE: find_circular_dependencies() USAGE: find_circular_dependencies(packageFilter="com.example") OUTPUT: List of circular dependency cycles Uses Tarjan's SCC algorithm to efficiently detect all cycles. Reports cycle paths and affected packages. Requires load_project to be called first. |
| analyze_change_impactA | Analyze the blast radius of changing a symbol. USAGE: analyze_change_impact(filePath="path/to/File.java", line=10, column=5) OUTPUT: All files and call sites affected, grouped by file Options:
Requires load_project to be called first. |
| analyze_control_flowA | Analyze the control flow structure of a method. USAGE: analyze_control_flow(filePath="path/to/File.java", line=10, column=5) OUTPUT: Branching points, loops, returns, throws, and nesting depth Reports:
Requires load_project to be called first. |
| analyze_data_flowA | Analyze data flow within a method. USAGE: analyze_data_flow(filePath="path/to/File.java", line=10, column=5) OUTPUT: Variables with read/write/declaration info Reports for each variable:
Useful for understanding side effects before extracting methods. Requires load_project to be called first. |
| get_di_registrationsA | Find all dependency injection registrations in the project. USAGE: get_di_registrations() OUTPUT: Components, configurations, beans, and injection points Scans for:
Returns empty categories for non-Spring projects (does not error). Requires load_project to be called first. |
| find_reflection_usageA | Find places where Java reflection API is used. USAGE: find_reflection_usage() OUTPUT: All reflection calls grouped by method type Detects calls to:
These usages are invisible to static reference searches and can break when types or methods are renamed. Requires load_project to be called first. |
| find_large_classesA | Find classes that exceed size thresholds. USAGE: find_large_classes(maxMethods=20, maxFields=10, maxLines=300) OUTPUT: List of classes exceeding any threshold with their metrics Default thresholds:
Requires load_project to be called first. |
| find_naming_violationsA | Check code against standard Java naming conventions. USAGE: find_naming_violations(filePath="path/to/File.java") OUTPUT: List of naming convention violations Conventions checked:
If filePath is omitted, scans all project files. Requires load_project to be called first. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pzalutski-pixel/javalens-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server