analyze_complexity

[analysis]

Analyzes code complexity metrics including cyclomatic complexity, lines of code, and method counts.

Parameters

NameTypeRequiredDescription
typeNamestringNoAnalyze a specific type.
filePathstringNoAnalyze a specific file.
projectNamestringNoOptional project name to limit the search scope.

Examples

Analyze complexity across the solution

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "analyze_complexity",
    "arguments": {}
  }
}
Response
{
  "success": true,
  "data": {
    "summary": {
      "totalTypes": 12,
      "totalMethods": 84,
      "totalLinesOfCode": 3200,
      "averageComplexity": 3.1,
      "maxComplexity": 12,
      "highComplexityMethodCount": 4
    },
    "types": [
      {
        "name": "SolutionManager",
        "fullName": "Glider.Services.SolutionManager",
        "kind": "Class",
        "filePath": "/path/to/SolutionManager.cs",
        "linesOfCode": 240,
        "methodCount": 8,
        "averageComplexity": 2.4,
        "methods": [
          {
            "name": "LoadSolutionAsync",
            "cyclomaticComplexity": 4,
            "linesOfCode": 32,
            "parameterCount": 1,
            "lineNumber": 58
          }
        ]
      }
    ]
  },
  "error": null
}

Response

Returns summary metrics and per-type complexity details

Go to Playground to test this tool interactively.