roslyn:get_complexity_metrics
Analyze C# code complexity by retrieving cyclomatic, nesting, LOC, parameter count, and cognitive metrics for a file or specific method. Supports zero-based coordinates for precise targeting.
Instructions
Get complexity metrics for a method or entire file.
METRICS: cyclomatic (decision points), nesting (max depth), loc (lines), parameters (count), cognitive (Sonar-style) USAGE: get_complexity_metrics(filePath) for file, or add line/column for specific method OUTPUT: Per-method breakdown with all requested metrics 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>"
},
"name": "roslyn:get_complexity_metrics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | No | Optional: zero-based line for specific method | |
| column | No | Optional: zero-based column | |
| metrics | No | Optional: specific metrics [cyclomatic, nesting, loc, parameters, cognitive] | |
| filePath | Yes | Absolute path to source file |