roslyn:extract_variable
Extract a selected expression into a new local variable in a C# source file, using zero-based line and column coordinates to define the cursor position or selection range.
Instructions
Extract an expression to a local variable.
USAGE: Position cursor on or select an expression. OUTPUT: Expression extracted to a new local variable. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1).
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": {
"filePath": "<filePath>",
"line": "<line>",
"column": "<column>"
},
"name": "roslyn:extract_variable"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | Zero-based line number | |
| column | Yes | Zero-based column number | |
| endLine | No | Optional: end line for selection | |
| preview | No | Preview mode (default: true) | |
| filePath | Yes | Absolute path to source file | |
| endColumn | No | Optional: end column for selection |