extract_function
Extract a contiguous block of lines into a new helper function. Detects parameters and call site using brace-counting and regex. Set dry_run=false to write changes.
Instructions
Extract a contiguous block of lines into a new helper function.
Brace-counting + regex param detection — not a full AST parser. Returns the
proposed helper, call site, and parameter list. Set dry_run=False to write.
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": {
"source": "<source>",
"line_start": "<line_start>",
"line_end": "<line_end>",
"new_name": "<new_name>"
},
"name": "extract_function"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | ||
| dry_run | No | ||
| line_end | Yes | ||
| new_name | Yes | ||
| line_start | Yes | ||
| return_type | No | void | |
| target_file | No |