Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions eng/common/mcp/azure-sdk-mcp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,34 @@ if (-not (Test-Path $toolInstallDirectory)) {
}
$exeName = Split-Path $tempExe -Leaf
$exeDestination = Join-Path $toolInstallDirectory $exeName
Copy-Item -Path $tempExe -Destination $exeDestination -Force

log "Package $package is installed at $exeDestination"
# Try to copy the new version
$updateSucceeded = $false
try {
Copy-Item -Path $tempExe -Destination $exeDestination -Force
$updateSucceeded = $true
}
catch {
if ($Run -and (Test-Path $exeDestination)) {
# In MCP mode and the executable exists, warn and fall back to the existing installed version
log -warn "Could not update '$exeDestination': $($_.Exception.Message)"
log -warn "Falling back to the currently installed version."
}
else {
# In update-only mode or the executable does not exist, exit with error
log -err "Could not install or update '$exeDestination': $($_.Exception.Message)"
exit 1
}
}

# Clean up temp directory
if (Test-Path $tempInstallDirectory) {
Remove-Item -Path $tempInstallDirectory -Recurse -Force -ErrorAction SilentlyContinue
}

if ($updateSucceeded) {
log "Executable $package is installed at $exeDestination"
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable reference $package uses lowercase, but the parameter is defined as $Package (uppercase P) on line 8. PowerShell is case-insensitive for variables, but for consistency and readability, the casing should match the parameter definition. Change $package to $Package.

Suggested change
log "Executable $package is installed at $exeDestination"
log "Executable $Package is installed at $exeDestination"

Copilot uses AI. Check for mistakes.
}
if (!$UpdatePathInProfile) {
log -warn "To add the tool to PATH for new shell sessions, re-run with -UpdatePathInProfile to modify the shell profile file."
}
Expand Down