[codefix]
Formats a C# document according to the project's formatting rules and returns diff output.
Small code fixes, using-directive cleanup, and formatting keep generated patches reviewable.
The model can separate behavioral edits from mechanical cleanup and keep diffs closer to the project style.
Try it locally in the GliderMCP playground
| Name | Type | Required | Description |
|---|---|---|---|
| filePath | string | Yes | File path to format. |
| projectName | string | No | Optional project name filter. |
| applyChanges | boolean | No | If true (default), applies changes to disk. If false, returns preview only. |
| includeDiff | boolean | No | Include unified diff in response. Default is true. |
| maxDiffChars | number | No | Max diff characters. Use 0 for unlimited. Default is 50000. |
| pathStyle | string | No | Path style: 'absolute' (default) or 'relative' (to solution root). |
Preview formatting a file
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "format_document",
"arguments": {
"filePath": "/Users/dev/MyProject/Program.cs",
"applyChanges": false
}
}
}{
"success": true,
"data": {
"filePath": "/path/to/File.cs",
"changed": true,
"applied": false,
"filesChanged": 1,
"unifiedDiff": "...",
"changedFiles": [
{
"filePath": "/path/to/File.cs",
"changeCount": 1,
"diff": "..."
}
]
},
"error": null
}Returns diff output for the formatting operation