apply_quick_fix
Apply Java code fixes by ID to resolve issues like missing imports, exception handling, or method declarations in source files.
Instructions
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:
add_import:{fullyQualifiedName} - Add an import statement
remove_import:{index} - Remove import at index
add_throws:{exceptionType} - Add throws declaration to method
surround_try_catch:{exceptionType} - Wrap statement in try-catch
IMPORTANT: Uses ZERO-BASED line numbers.
Requires load_project to be called first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Path to source file | |
| line | No | Zero-based line number (required for some fixes like add_throws) | |
| fixId | Yes | The fix ID from get_quick_fixes (e.g., 'add_import:java.util.List') |