[solution]
Synchronizes one or more documents from disk into the in-memory workspace without a full reload for .cs edits. If no paths are provided, sync runs only when pending watcher changes exist unless forceSync is true.
Agents edit files incrementally; the analysis snapshot needs to keep up without paying the cost of a full reload every time.
It refreshes changed documents so follow-up diagnostics, references, and impact checks reflect the latest patch.
Try it locally in the Glider playground
| Name | Type | Required | Description |
|---|---|---|---|
| filePaths | json | No | Optional file paths to sync. JSON array of strings. Named paths get a state each: synced, current, not-in-workspace, unavailable-on-disk, read-error, apply-failed, or reloaded. Named paths always compare content. A sweep with no paths trusts file length and timestamp instead. |
| forceSync | boolean | No | Forces a full sync when no watcher change is pending. Only affects the no-paths form; named paths always sync. Default is false. |
| pathStyle | string | No | Path style: 'absolute' (default) or 'relative' (to solution root). |
Sync when watcher has pending changes
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "sync",
"arguments": {}
}
}{
"success": true,
"data": {
"updated": [
"/Users/dev/MyProject/Program.cs"
],
"skipped": [],
"totalSynced": 1,
"revisionBefore": 3,
"revisionAfter": 4,
"fallbackToReload": false,
"fallbackReason": null,
"status": "synced",
"filesConsidered": 2,
"filesSkippedUnchanged": 1,
"files": [
{
"filePath": "/Users/dev/MyProject/Program.cs",
"state": "synced"
},
{
"filePath": "/Users/dev/MyProject/Other.cs",
"state": "current"
}
]
},
"error": null
}Force sync all documents
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "sync",
"arguments": {
"forceSync": true
}
}
}{
"success": true,
"data": {
"updated": [
"/Users/dev/MyProject/Program.cs"
],
"skipped": [],
"totalSynced": 1,
"revisionBefore": 3,
"revisionAfter": 4,
"fallbackToReload": false,
"fallbackReason": null,
"status": "synced",
"filesConsidered": 2,
"filesSkippedUnchanged": 1,
"files": [
{
"filePath": "/Users/dev/MyProject/Program.cs",
"state": "synced"
},
{
"filePath": "/Users/dev/MyProject/Other.cs",
"state": "current"
}
]
},
"error": null
}Sync a specific file
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "sync",
"arguments": {
"filePaths": "[\"/Users/dev/MyProject/Program.cs\"]"
}
}
}{
"success": true,
"data": {
"updated": [
"/Users/dev/MyProject/Program.cs"
],
"skipped": [],
"totalSynced": 1,
"revisionBefore": 3,
"revisionAfter": 4,
"fallbackToReload": false,
"fallbackReason": null,
"status": "synced",
"filesConsidered": 2,
"filesSkippedUnchanged": 1,
"files": [
{
"filePath": "/Users/dev/MyProject/Program.cs",
"state": "synced"
},
{
"filePath": "/Users/dev/MyProject/Other.cs",
"state": "current"
}
]
},
"error": null
}Returns updated and skipped files plus revision info. status names the outcome: synced, already-current, partial, no-op, read-failed, apply-failed, or reloaded. It separates a snapshot that already held your edits from a call that examined nothing. filesConsidered and filesSkippedUnchanged report how much was checked. files gives a per-file state when you name paths, and is empty for a sweep. status supersedes the older noPendingChanges flag, which is kept for callers that read it.