sync

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

Why this tool exists

Agents edit files incrementally; the analysis snapshot needs to keep up without paying the cost of a full reload every time.

How it helps the agent

It refreshes changed documents so follow-up diagnostics, references, and impact checks reflect the latest patch.

Try it locally in the Glider playground

Parameters

NameTypeRequiredDescription
filePathsjsonNoOptional 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.
forceSyncbooleanNoForces a full sync when no watcher change is pending. Only affects the no-paths form; named paths always sync. 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,
    "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

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,
    "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

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,
    "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
}

Response Notes

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.

↑/↓ NavigateEnter OpenSpace Expand