extract_function
Convert selected code lines into a reusable function by automatically identifying parameters and return values for TypeScript/JavaScript, Python, and Go.
Instructions
Extract a range of lines into a new named function. Detects parameters (variables from outer scope) and return values (variables used after the range). Supports TypeScript/JavaScript, Python, and Go.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | File path (relative to project root) | |
| start_line | Yes | First line to extract (1-indexed, inclusive) | |
| end_line | Yes | Last line to extract (1-indexed, inclusive) | |
| function_name | Yes | Name for the extracted function | |
| dry_run | No | Preview changes without applying (default: false) |