get_diagnostics
[diagnostics]
Returns compiler diagnostics and optional analyzer diagnostics for the loaded C# workspace.
Try it locally in the Glider playground
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| filePath | string | No | Optional file path filter. |
| projectName | string | No | Optional project name filter. |
| includeAnalyzers | boolean | No | Include analyzer/IDE diagnostics. Default is false. Default: false |
| summaryOnly | boolean | No | When true, returns summary counts only. Default is false. Default: false |
| severity | string | No | Minimum severity: 'error', 'warning', 'info', or 'hidden'. Default is 'warning'. Default: "warning" |
| category | string | No | Optional category filter (e.g., 'Compiler', 'Style'). |
| idPrefix | string | No | Optional diagnostic ID prefix filter (e.g., 'CS', 'CA', 'IDE'). |
| pathStyle | string | No | Path style: 'absolute' (default) or 'relative' (to solution root). Default: "absolute" |
| sortBy | string | No | Optional sort: 'severity', 'filePath', 'id', 'lineNumber', 'projectName'. |
| sortOrder | string | No | Sort order: 'asc' (default) or 'desc'. Default: "asc" |
| skip | number | No | Pagination offset. Default is 0. Default: 0 |
| take | number | No | Pagination size. Default is 200. Default: 200 |
| responseDetail | string | No | compact 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)
{}Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_diagnostics",
"arguments": {}
}
}{
"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
{
"severity": "error"
}Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_diagnostics",
"arguments": {
"severity": "error"
}
}
}Summary view by project and severity
{
"summaryOnly": true,
"severity": "warning"
}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.