sync

[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.

Parameters

NameTypeRequiredDescription
filePathsjsonNoOptional file paths to sync. JSON array of strings. If omitted/empty, sync runs only when pending watcher changes exist unless forceSync is true.
forceSyncbooleanNoWhen true, forces sync of all documents even if no pending changes are detected. Default is false.
pathStylestringNoPath style: 'absolute' (default) or 'relative' (to solution root).

Examples

Sync when watcher has pending changes

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "sync",
    "arguments": {}
  }
}
Response
{
  "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

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "sync",
    "arguments": {
      "forceSync": true
    }
  }
}
Response
{
  "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

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "sync",
    "arguments": {
      "filePaths": "[\"/Users/dev/MyProject/Program.cs\"]"
    }
  }
}
Response
{
  "success": true,
  "data": {
    "updated": [
      "/Users/dev/MyProject/Program.cs"
    ],
    "skipped": [],
    "totalSynced": 1,
    "revisionBefore": 3,
    "revisionAfter": 4,
    "fallbackToReload": false,
    "fallbackReason": null
  },
  "error": null
}

Response Notes

Returns updated and skipped files plus revision info. Workspace load diagnostics are not returned by sync.