get_code_fragment
Extract a named class, method, or constructor body from a Java file using AST-accurate parsing, with fallback to regex or context window.
Instructions
Extract one named class/method/constructor body from a Java file.
Uses AST-accurate parsing when tree-sitter-java is installed, else a regex-based heuristic; falls back to a plain text-context window (match_type="context_window") if the symbol isn't a recognisable Java declaration.
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": {
"path": "<path>",
"symbol": "<symbol>"
},
"name": "get_code_fragment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | ||
| path | Yes | ||
| repo | No | ||
| owner | No | ||
| symbol | Yes |