[solution]
Synchronizes one or more documents from disk into the in-memory workspace (faster than reload for .cs edits). If no paths are provided, sync runs only when pending watcher changes exist unless forceSync is true.
Try this tool in Playground.
| Name | Type | Required | Description |
|---|---|---|---|
| filePaths | json | No | Optional file paths to sync. JSON array of strings. If omitted/empty, sync runs only when pending watcher changes exist unless forceSync is true. |
| forceSync | boolean | No | When true, forces sync of all documents even if no pending changes are detected. 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
},
"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
},
"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
},
"error": null
}Returns updated and skipped files plus revision info. Workspace load diagnostics are not returned by sync.