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
13 changes: 10 additions & 3 deletions src/WinGetMCPServer/WingetPackageTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ public async Task<CallToolResult> InstallPackage(

if (installResult.Status == InstallResultStatus.Ok)
{
// Send a completed progress entry in the event that async progress forwarding didn't
progress.Report(CreateInstallProgressNotification(PackageInstallProgressState.Finished, 1.0, 1.0));
findResult = ReFindForPackage(catalogPackage.DefaultInstallVersion);
}

Expand All @@ -167,7 +169,7 @@ private ConnectResult ConnectCatalogWithResult(string? catalog = null)
for (int i = 0; i < catalogs.Count; ++i)
{
var catalogRef = catalogs[i];
if (string.IsNullOrEmpty(catalog) || catalogRef?.Info.Id == catalog)
if (string.IsNullOrEmpty(catalog) || catalogRef?.Info.Name == catalog)

This comment was marked as resolved.

This comment was marked as resolved.

{
createCompositePackageCatalogOptions.Catalogs.Add(catalogs[i]);
}
Expand Down Expand Up @@ -232,10 +234,15 @@ private FindPackagesResult FindForIdentifier(PackageCatalog catalog, string quer
}

private static ProgressNotificationValue CreateInstallProgressNotification(ref InstallProgress installProgress)
{
return CreateInstallProgressNotification(installProgress.State, installProgress.DownloadProgress, installProgress.InstallationProgress);
}

private static ProgressNotificationValue CreateInstallProgressNotification(PackageInstallProgressState state, double downloadProgress, double installProgress)
{
string? message = null;

switch (installProgress.State)
switch (state)
{
case PackageInstallProgressState.Queued:
message = "The install operation is queued";
Expand All @@ -261,7 +268,7 @@ private static ProgressNotificationValue CreateInstallProgressNotification(ref I

ProgressNotificationValue result = new ProgressNotificationValue()
{
Progress = (float)((installProgress.DownloadProgress * downloadPercentage) + (installProgress.InstallationProgress * (1.0f - downloadPercentage))),
Progress = (float)((downloadProgress * downloadPercentage) + (installProgress * (1.0f - downloadPercentage))),
Message = message,
};

Expand Down
Loading