[diagnostics]
Gets compiler diagnostics (warnings, errors, info) for the loaded solution.
| Name | Type | Required | Description |
|---|---|---|---|
| filePath | string | No | Limit diagnostics to a specific file path. |
| projectName | string | No | Limit diagnostics to a specific project. |
| severity | string | No | Minimum severity: error, warning, info, hidden. |
Get diagnostics with default severity
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_diagnostics",
"arguments": {}
}
}{
"success": true,
"data": {
"diagnosticCount": 3,
"errorCount": 1,
"warningCount": 2,
"infoCount": 0,
"diagnostics": [
{
"id": "CS1002",
"severity": "Error",
"message": "; expected",
"filePath": "/path/to/File.cs",
"lineNumber": 42,
"column": 17,
"endLineNumber": 42,
"endColumn": 18,
"category": "Syntax",
"projectName": "MyProject"
}
]
},
"error": null
}Get errors for a specific file
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_diagnostics",
"arguments": {
"filePath": "/path/to/File.cs",
"severity": "error"
}
}
}{
"success": true,
"data": {
"diagnosticCount": 3,
"errorCount": 1,
"warningCount": 2,
"infoCount": 0,
"diagnostics": [
{
"id": "CS1002",
"severity": "Error",
"message": "; expected",
"filePath": "/path/to/File.cs",
"lineNumber": 42,
"column": 17,
"endLineNumber": 42,
"endColumn": 18,
"category": "Syntax",
"projectName": "MyProject"
}
]
},
"error": null
}Returns diagnostics grouped by severity with location details
Go to Playground to test this tool interactively.