implementation
Locate implementations of Java interfaces or abstract methods by analyzing code at specific positions to support development navigation and understanding.
Instructions
Find implementations of an interface or abstract method.
Args: file_path: Absolute path to the Java file line: 0-indexed line number character: 0-indexed character position
Returns: Dictionary with 'locations' array or 'status'/'message' if initializing
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| line | Yes | ||
| character | Yes |
Implementation Reference
- The core handler function for the 'implementation' MCP tool. It uses the LSP 'textDocument/implementation' request to find implementations of interfaces or abstract methods at the specified position in a Java file.@mcp.tool() async def implementation( file_path: str, line: int, character: int, ) -> dict: """ Find implementations of an interface or abstract method. Args: file_path: Absolute path to the Java file line: 0-indexed line number character: 0-indexed character position Returns: Dictionary with 'locations' array or 'status'/'message' if initializing """ manager = get_manager() if manager is None: return {"status": "error", "message": "Server not initialized"} client, status = await manager.get_client_for_file_with_status(Path(file_path)) if client is None: return {"status": "initializing", "message": status} await client.ensure_file_open(file_path) response = await client.request( LSP_TEXT_DOCUMENT_IMPLEMENTATION, { "textDocument": {"uri": path_to_uri(file_path)}, "position": {"line": line, "character": character} } ) return format_locations(response)
- src/jons_mcp_java/tools/__init__.py:1-22 (registration)The tools/__init__.py re-exports the 'implementation' tool function, making it available for import and likely registration in the MCP server."""MCP tools for Java language support.""" from jons_mcp_java.tools.navigation import ( definition, implementation, references, type_definition, ) from jons_mcp_java.tools.symbols import document_symbols, workspace_symbols from jons_mcp_java.tools.diagnostics import diagnostics from jons_mcp_java.tools.info import hover __all__ = [ "definition", "references", "implementation", "type_definition", "document_symbols", "workspace_symbols", "diagnostics", "hover", ]
- src/jons_mcp_java/constants.py:16-16 (helper)Constant defining the LSP method name used by the 'implementation' tool.LSP_TEXT_DOCUMENT_IMPLEMENTATION = "textDocument/implementation"