apply_quick_fix
Apply a code fix by ID to Java source files for operations like adding imports, removing imports, adding throws, or surrounding with try-catch. Requires load_project.
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 | |
| fixId | Yes | The fix ID from get_quick_fixes (e.g., 'add_import:java.util.List') | |
| line | No | Zero-based line number (required for some fixes like add_throws) |