get_diagnostics
Get compilation errors and warnings for a Java file or entire project, with optional severity filtering and result limits. Use it to find syntax errors, type mismatches, and missing imports.
Instructions
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.
severity (optional, compared case-insensitively): error or warning keeps the diagnostics of that severity; all (the default) keeps both. Any other value is rejected with INVALID_PARAMETER.
Every file is checked and every diagnostic kept is counted in totalDiagnostics, errorCount and warningCount; maxResults limits only the diagnostics listed, and meta.truncated says when the list is cut.
Requires load_project to be called first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | No | Optional path to source file. If omitted, checks all files. | |
| severity | No | Filter by severity, case-insensitive: 'error', 'warning' or 'all' (default: 'all') | |
| maxResults | No | Max diagnostics to return (default 100) |