use_function
Replace duplicate function bodies project-wide with calls to the selected function, using LSP coordinates and a dry-run preview to review changes before applying.
Instructions
Replace code that duplicates a function's body with calls to that function, across the whole project. Point at the name of a module-level function (0-based LSP line/character, UTF-16 units); statements matching its body pattern are rewritten into calls. Defaults to a Dry Run preview; set apply=true to write. Sites that cannot be proven to match are reported as uncertain_occurrences for you to adjudicate, never silently rewritten. Supply expected_symbol when edits may have intervened since your LSP answer, so a stale Position fails safely. Locate the function with your LSP first; this tool only changes code.
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": {
"file": "<file>",
"line": "<line>",
"character": "<character>"
},
"name": "use_function"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | ||
| line | Yes | ||
| root | No | ||
| apply | No | ||
| character | Yes | ||
| expected_symbol | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||