[refactoring]
Lists available code fixes for diagnostics at a specific location.
Try this tool in Playground.
| Name | Type | Required | Description |
|---|---|---|---|
| filePath | string | Yes | File path containing the diagnostic. |
| lineNumber | number | Yes | 1-based line number. |
| column | number | Yes | 1-based column number. |
| diagnosticId | string | No | Optional diagnostic ID filter (e.g., 'CS0246'). |
| projectName | string | No | Optional project name filter. |
| maxFixes | number | No | Max fixes per diagnostic. Default is 10. |
| includePreviewDiff | boolean | No | Include preview diff for each fix. Default is false. |
| maxPreviewDiffChars | number | No | Max characters for preview diffs. Default is 2000. |
| pathStyle | string | No | Path style: 'absolute' (default) or 'relative' (to solution root). |
| timeout_ms | number | No | Timeout in milliseconds. Use 0 to disable. Default is 30000. |
Get code fixes at a location
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_code_fixes",
"arguments": {
"filePath": "/Users/dev/MyProject/Program.cs",
"lineNumber": 10,
"column": 15
}
}
}{
"success": true,
"data": {
"filePath": "/path/to/File.cs",
"lineNumber": 10,
"column": 15,
"diagnosticsAtLocation": 1,
"totalFixesAvailable": 2,
"diagnostics": [
{
"diagnosticId": "CS0246",
"severity": "Error",
"message": "The type or namespace name 'X' could not be found",
"span": {
"startLine": 10,
"startColumn": 15,
"endLine": 10,
"endColumn": 16
},
"fixes": [
{
"fixId": "...",
"title": "Add using ...",
"equivalenceKey": "...",
"previewDiff": null
}
]
}
]
},
"error": null
}Returns fixes grouped by diagnostic at the location