roslyn:extract_interface
Extract an interface from a class or struct by specifying its location and a new interface name. Automatically includes all public instance members to generate ready-to-use interface code, supporting dependency injection and testability.
Instructions
Generate an interface from a class or struct. Extracts all public instance members (methods, properties, events).
USAGE: Position on class declaration, provide interfaceName="IMyService". OUTPUT: Generated interface code ready to insert. Useful for dependency injection and testability. 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>",
"interfaceName": "<interfaceName>"
},
"name": "roslyn:extract_interface"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | Zero-based line number (editor line - 1) | |
| column | Yes | Zero-based column number (editor column - 1) | |
| filePath | Yes | Absolute path to source file containing the class | |
| interfaceName | Yes | Name for the new interface (e.g., 'IMyService') | |
| includeMemberNames | No | Optional: specific member names to include (omit to include all public members) |