Browse documentation

get_diagnostics

[diagnostics]

Returns compiler diagnostics and optional analyzer diagnostics for the loaded C# workspace.

Try it locally in the Glider playground

Parameters

NameTypeRequiredDescription
filePathstringNoOptional file path filter.
projectNamestringNoOptional project name filter.
includeAnalyzersbooleanNoInclude analyzer/IDE diagnostics. Default is false. Default: false
summaryOnlybooleanNoWhen true, returns summary counts only. Default is false. Default: false
severitystringNoMinimum severity: 'error', 'warning', 'info', or 'hidden'. Default is 'warning'. Default: "warning"
categorystringNoOptional category filter (e.g., 'Compiler', 'Style').
idPrefixstringNoOptional diagnostic ID prefix filter (e.g., 'CS', 'CA', 'IDE').
pathStylestringNoPath style: 'absolute' (default) or 'relative' (to solution root). Default: "absolute"
sortBystringNoOptional sort: 'severity', 'filePath', 'id', 'lineNumber', 'projectName'.
sortOrderstringNoSort order: 'asc' (default) or 'desc'. Default: "asc"
skipnumberNoPagination offset. Default is 0. Default: 0
takenumberNoPagination size. Default is 200. Default: 200
responseDetailstringNocompact returns results and actionable state. full adds diagnostic metadata under responseDiagnostics. Default: "compact"

Examples

Replace sample paths and symbol keys with values from your workspace.

Get warnings and errors (default)

Arguments
{}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_diagnostics",
    "arguments": {}
  }
}
Illustrative response
{
  "success": true,
  "restoreHints": [],
  "restoreHintsOmittedProjectCount": 0,
  "restoreHintsNextStep": null,
  "diagnosticCount": 3,
  "errorCount": 1,
  "warningCount": 2,
  "infoCount": 0,
  "paging": {
    "total": 3
  },
  "diagnostics": [
    {
      "id": "CS1002",
      "severity": "Error",
      "message": "; expected",
      "filePath": "/path/to/File.cs",
      "lineNumber": 42,
      "column": 17,
      "endLineNumber": 42,
      "endColumn": 18,
      "category": "Syntax",
      "projectName": "MyProject"
    }
  ],
  "analyzerLoadFailures": [
    {
      "analyzerPath": "/path/to/BrokenAnalyzer.dll",
      "projectName": "MyProject",
      "reason": "Glider could not read the analyzer assembly: Unknown file format."
    }
  ],
  "comReferenceHints": [
    {
      "projectName": "MyProject",
      "missingWrappers": [
        "Interop.MyComLib.dll"
      ],
      "remedy": "build",
      "note": "This project's COMReference interop wrappers (Interop.*.dll) are absent. A missing wrapper makes its COM types report CS0246. Run a build, then reload."
    }
  ]
}

Get error diagnostics only

Arguments
{
  "severity": "error"
}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_diagnostics",
    "arguments": {
      "severity": "error"
    }
  }
}

Summary view by project and severity

Arguments
{
  "summaryOnly": true,
  "severity": "warning"
}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_diagnostics",
    "arguments": {
      "summaryOnly": true,
      "severity": "warning"
    }
  }
}

Response Notes

Use includeAnalyzers=true to include analyzer/IDE diagnostics. Workspace load diagnostics are available via server_status with includeWorkspaceDiagnostics=true. Build a project with a COMReference first. The generated interop assembly is read from disk at load time. A wrapper generated later needs a reload.

Returns compiler and analyzer diagnostics after filters, with summary or paged output. analyzerLoadFailures names skipped analyzers; workspace load diagnostics are separate. comReferenceHints identifies missing COM wrappers and the build or reload remedy. restoreHints lists up to 20 projects with relevant compiler errors, diagnosticIds, unverified restoreState, and restore/build plus reload advice. restoreHintsOmittedProjectCount and restoreHintsNextStep explain how to request omitted projects with projectName. Glider preserves compiler errors and does not run restore or infer restore state from asset paths or timestamps. Results use top-level fields with success. Compact is the default; full adds responseDiagnostics. Both modes retain errors, coverage, partial state, and recovery advice.