extract_interface
Extract an interface from a Java class by choosing public methods, then generate the interface file and an edit adding an implements clause to the class.
Instructions
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. The interface imports each type its signatures name that it cannot see unimported, a member type by its canonical name (import pkg.Outer.Inner).
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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"filePath": "<filePath>",
"line": "<line>",
"column": "<column>",
"interfaceName": "<interfaceName>"
},
"name": "extract_interface"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | Zero-based line number of class declaration | |
| column | Yes | Zero-based column number | |
| filePath | Yes | Path to source file containing the class | |
| methodNames | No | Specific method names to include (default: all public non-static methods) | |
| interfaceName | Yes | Name for the new interface |