consolidate_package_version

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

Why this tool exists

Framework and package behavior often explains local code, but the source is outside the repo.

How it helps the agent

The model can inspect external definitions and package usage evidence instead of guessing from API names.

Try it locally in the GliderMCP playground

Parameters

NameTypeRequiredDescription
packageIdstringYesNuGet package ID to rewrite.
targetVersionstringYesTarget version to write into matching declarations.
projectNamestringNoOptional project name filter.
promoteToCentralPackageManagementbooleanNoWhen true, promotes matching SDK-style PackageReference declarations into Directory.Packages.props and removes inline version declarations. Legacy package styles stay unchanged in this mode.
applyChangesbooleanNoApply changes to disk. Default is false for preview-first behavior.
includeDiffbooleanNoInclude a unified diff in the response. Default is true.
maxDiffCharsnumberNoMaximum unified diff characters to return. Default is 50000. Use 0 for unlimited.
includePerFileDiffbooleanNoInclude per-file diffs in changedFiles. Default is true.
pathStylestringNoPath style: 'absolute' (default) or 'relative' (to solution root).

Examples

Preview version alignment for one package

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "consolidate_package_version",
    "arguments": {
      "packageId": "Newtonsoft.Json",
      "targetVersion": "13.0.4",
      "applyChanges": false
    }
  }
}
Response
{
  "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

Request
{
  "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
    }
  }
}
Response
{
  "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

Request
{
  "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
    }
  }
}
Response
{
  "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
}

Response Notes

Returns preview/apply status and per-file diffs for supported package declaration rewrites

↑/↓ NavigateEnter OpenSpace Expand