introduce_parameter
Convert a value inside a function into a new parameter, using the original expression as its default. Select the code range, name the parameter, and get a dry-run preview before applying.
Instructions
Turn a value used inside a function into a new parameter, with the original expression becoming the parameter's default. Select the expression — a name or attribute access such as a module constant or self. — with a Range (start_line/start_character to end_line/end_character, 0-based, character in UTF-16 units) inside the function body and give the parameter a name. Defaults to a Dry Run preview; set apply=true to write. Read the code 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>",
"start_line": "<start_line>",
"start_character": "<start_character>",
"end_line": "<end_line>",
"end_character": "<end_character>",
"parameter_name": "<parameter_name>"
},
"name": "introduce_parameter"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | ||
| root | No | ||
| apply | No | ||
| end_line | Yes | ||
| start_line | Yes | ||
| end_character | Yes | ||
| parameter_name | Yes | ||
| start_character | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||