roslyn:generate_constructor
Generate a constructor from a type's fields and properties. Provide the file path and zero-based line/column of the type declaration to receive ready-to-paste constructor code.
Instructions
Generate a constructor from fields and/or properties of a type.
USAGE: Position on class/struct declaration. Use includeProperties=true for auto-properties. OUTPUT: constructorCode string ready to paste, parameter list, and field assignments. 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:generate_constructor"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | Zero-based line number on the type declaration | |
| column | Yes | Zero-based column number | |
| filePath | Yes | Absolute path to source file containing the type | |
| includeProperties | No | Include properties with setters (default: false) | |
| initializeToDefault | No | Use ?? default for nullable types (default: false) |