extract_method
Extracts a selected code region into a new method to enhance code modularity and maintainability in Python projects.
Instructions
Extract a code region as a new method.
Args: project_path: Root directory of the Python project file_path: File path relative to project_path start_line: Start line (1-based) start_col: Start column (0-based) end_line: End line (1-based) end_col: End column (0-based) new_name: Name for the extracted method
Returns: JSON with success status and list of changed files
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": {
"project_path": "<project_path>",
"file_path": "<file_path>",
"start_line": "<start_line>",
"start_col": "<start_col>",
"end_line": "<end_line>",
"end_col": "<end_col>",
"new_name": "<new_name>"
},
"name": "extract_method"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | ||
| file_path | Yes | ||
| start_line | Yes | ||
| start_col | Yes | ||
| end_line | Yes | ||
| end_col | Yes | ||
| new_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |