[external]
Rewrites one package to a target version across supported PackageReference, packages.config, and legacy package-folder HintPath declarations. Returns a preview diff by default.
Framework and package behavior often explains local code, but the source is outside the repo.
The model can inspect external definitions and package usage evidence instead of guessing from API names.
Try it locally in the GliderMCP playground
| Name | Type | Required | Description |
|---|---|---|---|
| packageId | string | Yes | NuGet package ID to rewrite. |
| targetVersion | string | Yes | Target version to write into matching declarations. |
| projectName | string | No | Optional project name filter. |
| promoteToCentralPackageManagement | boolean | No | When true, promotes matching SDK-style PackageReference declarations into Directory.Packages.props and removes inline version declarations. Legacy package styles stay unchanged in this mode. |
| applyChanges | boolean | No | Apply changes to disk. Default is false for preview-first behavior. |
| includeDiff | boolean | No | Include a unified diff in the response. Default is true. |
| maxDiffChars | number | No | Maximum unified diff characters to return. Default is 50000. Use 0 for unlimited. |
| includePerFileDiff | boolean | No | Include per-file diffs in changedFiles. Default is true. |
| pathStyle | string | No | Path style: 'absolute' (default) or 'relative' (to solution root). |
Preview version alignment for one package
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "consolidate_package_version",
"arguments": {
"packageId": "Newtonsoft.Json",
"targetVersion": "13.0.4",
"applyChanges": false
}
}
}{
"success": true,
"data": {
"packageId": "Newtonsoft.Json",
"targetVersion": "13.0.4",
"promoteToCentralPackageManagement": true,
"changed": true,
"applied": false,
"centralPackageFilePath": "/path/to/Directory.Packages.props",
"filesChanged": 2,
"declarationCount": 3,
"changedFiles": [
{
"filePath": "/path/to/MyProject.csproj",
"changeCount": 2
},
{
"filePath": "/path/to/Directory.Packages.props",
"changeCount": 1
}
]
},
"error": null
}Preview SDK-style promotion into central package management
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "consolidate_package_version",
"arguments": {
"packageId": "Newtonsoft.Json",
"targetVersion": "13.0.4",
"promoteToCentralPackageManagement": true,
"applyChanges": false
}
}
}{
"success": true,
"data": {
"packageId": "Newtonsoft.Json",
"targetVersion": "13.0.4",
"promoteToCentralPackageManagement": true,
"changed": true,
"applied": false,
"centralPackageFilePath": "/path/to/Directory.Packages.props",
"filesChanged": 2,
"declarationCount": 3,
"changedFiles": [
{
"filePath": "/path/to/MyProject.csproj",
"changeCount": 2
},
{
"filePath": "/path/to/Directory.Packages.props",
"changeCount": 1
}
]
},
"error": null
}Apply a scoped package rewrite
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "consolidate_package_version",
"arguments": {
"packageId": "Newtonsoft.Json",
"targetVersion": "13.0.4",
"projectName": "MyProject",
"applyChanges": true
}
}
}{
"success": true,
"data": {
"packageId": "Newtonsoft.Json",
"targetVersion": "13.0.4",
"promoteToCentralPackageManagement": true,
"changed": true,
"applied": false,
"centralPackageFilePath": "/path/to/Directory.Packages.props",
"filesChanged": 2,
"declarationCount": 3,
"changedFiles": [
{
"filePath": "/path/to/MyProject.csproj",
"changeCount": 2
},
{
"filePath": "/path/to/Directory.Packages.props",
"changeCount": 1
}
]
},
"error": null
}Returns preview/apply status and per-file diffs for supported package declaration rewrites