Skip to content
Merged
Show file tree
Hide file tree
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
74 changes: 37 additions & 37 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<Project>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wish GitHub would tell me what is different with the whitespace

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I wish VS wouldn't touch the whitespace.

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<!--
!!! Remove or update this on the next Microsoft.Windows.CsWinRT package version update. !!!
-->
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="3.1.2" />
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<PackageVersion Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.6" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.Msix.Utils" Version="2.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageVersion Include="Microsoft.PowerShell.SDK" Version="7.4.6" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.1.6" />
<PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.26100.1742" />
<PackageVersion Include="ModelContextProtocol" Version="0.2.0-preview.3" />
<PackageVersion Include="Moq" Version="4.18.2" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="nunit" Version="3.12.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageVersion Include="Octokit" Version="4.0.3" />
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageVersion Include="Semver" Version="2.3.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageVersion Include="System.Data.SqlClient" Version="4.8.6" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.Security.Principal.Windows" Version="5.0.0" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
</ItemGroup>
</Project>
-->
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="3.1.2" />
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<PackageVersion Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.6" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.Msix.Utils" Version="2.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageVersion Include="Microsoft.PowerShell.SDK" Version="7.4.6" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.1.6" />
<PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.26100.1742" />
<PackageVersion Include="ModelContextProtocol" Version="0.3.0-preview.3" />
<PackageVersion Include="Moq" Version="4.18.2" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="nunit" Version="3.12.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageVersion Include="Octokit" Version="4.0.3" />
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageVersion Include="Semver" Version="2.3.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageVersion Include="System.Data.SqlClient" Version="4.8.6" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.Security.Principal.Windows" Version="5.0.0" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/WinGetMCPServer/Exceptions/ToolResponseException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ namespace WinGetMCPServer.Exceptions
/// </summary>
internal class ToolResponseException : Exception
{
public ToolResponseException(CallToolResponse toolResponse)
public ToolResponseException(CallToolResult toolResponse)
{
this.Response = toolResponse;
}

public CallToolResponse Response { get; private set; }
public CallToolResult Response { get; private set; }
}
}
24 changes: 12 additions & 12 deletions src/WinGetMCPServer/Response/PackageResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ internal static class PackageResponse
/// </summary>
/// <param name="connectResult">The connect result.</param>
/// <returns>The response.</returns>
public static CallToolResponse ForConnectError(ConnectResult connectResult)
public static CallToolResult ForConnectError(ConnectResult connectResult)
{
return new CallToolResponse()
return new CallToolResult()
{
IsError = true,
Content = [new Content() { Text = $"Failed when connecting to the package source with error: {connectResult.ExtendedErrorCode.Message} [0x{connectResult.ExtendedErrorCode.HResult:X8}]" }],
Content = [new TextContentBlock() { Text = $"Failed when connecting to the package source with error: {connectResult.ExtendedErrorCode.Message} [0x{connectResult.ExtendedErrorCode.HResult:X8}]" }],
};
}

Expand All @@ -34,25 +34,25 @@ public static CallToolResponse ForConnectError(ConnectResult connectResult)
/// </summary>
/// <param name="findResult">The find packages result.</param>
/// <returns>The response.</returns>
public static CallToolResponse ForFindError(FindPackagesResult findResult)
public static CallToolResult ForFindError(FindPackagesResult findResult)
{
return new CallToolResponse()
return new CallToolResult()
{
IsError = true,
Content = [new Content() { Text = $"Failed when finding packages with reason {findResult.Status} and error: {findResult.ExtendedErrorCode.Message} [0x{findResult.ExtendedErrorCode.HResult:X8}]" }],
Content = [new TextContentBlock() { Text = $"Failed when finding packages with reason {findResult.Status} and error: {findResult.ExtendedErrorCode.Message} [0x{findResult.ExtendedErrorCode.HResult:X8}]" }],
};
}

/// <summary>
/// Creates a response that indicates the operation was cancelled before any changes were made.
/// </summary>
/// <returns>The response.</returns>
public static CallToolResponse ForCancelBeforeSystemChange()
public static CallToolResult ForCancelBeforeSystemChange()
{
return new CallToolResponse()
return new CallToolResult()
{
IsError = true,
Content = [new Content() { Text = $"The operation was cancelled before any system change was started" }],
Content = [new TextContentBlock() { Text = $"The operation was cancelled before any system change was started" }],
};
}

Expand All @@ -62,7 +62,7 @@ public static CallToolResponse ForCancelBeforeSystemChange()
/// <param name="identifer">The identifier used when searching.</param>
/// <param name="source">The source that was searched.</param>
/// <returns>The response.</returns>
public static CallToolResponse ForEmptyFind(string identifer, string? source)
public static CallToolResult ForEmptyFind(string identifer, string? source)
{
PackageIdentityErrorResult result = new()
{
Expand All @@ -81,7 +81,7 @@ public static CallToolResponse ForEmptyFind(string identifer, string? source)
/// <param name="source">The source that was searched.</param>
/// <param name="findResult">The result that contains multiple packages.</param>
/// <returns>The response.</returns>
public static CallToolResponse ForMultiFind(string identifer, string? source, FindPackagesResult findResult)
public static CallToolResult ForMultiFind(string identifer, string? source, FindPackagesResult findResult)
{
PackageIdentityErrorResult result = new()
{
Expand All @@ -101,7 +101,7 @@ public static CallToolResponse ForMultiFind(string identifer, string? source, Fi
/// <param name="installResult">The install operation result.</param>
/// <param name="findResult">The post-install package data.</param>
/// <returns>The response.</returns>
public static CallToolResponse ForInstallOperation(InstallResult installResult, FindPackagesResult? findResult)
public static CallToolResult ForInstallOperation(InstallResult installResult, FindPackagesResult? findResult)
{
InstallOperationResult result = new InstallOperationResult();

Expand Down
12 changes: 6 additions & 6 deletions src/WinGetMCPServer/Response/ToolResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public static void CheckGroupPolicy()
{
if (!GroupPolicy.GetInstance().IsEnabled(Policy.McpServer))
{
throw new ToolResponseException(new CallToolResponse()
throw new ToolResponseException(new CallToolResult()
{
IsError = true,
Content = [new Content() { Text = "The Windows Package Manager MCP server is disabled by group policy." }]
Content = [new TextContentBlock() { Text = "The Windows Package Manager MCP server is disabled by group policy." }]
});
}
}
Expand All @@ -39,7 +39,7 @@ public static void CheckGroupPolicy()
/// <param name="value">The object to return in the response.</param>
/// <param name="isError">Whether or not the response is an error.</param>
/// <returns>The response.</returns>
public static CallToolResponse FromObject(object value, bool isError = false)
public static CallToolResult FromObject(object value, bool isError = false)
{
return FromObject(value, isError, GetDefaultJsonOptions());
}
Expand All @@ -51,12 +51,12 @@ public static CallToolResponse FromObject(object value, bool isError = false)
/// <param name="isError">Whether or not the response is an error.</param>
/// <param name="jsonSerializerOptions">The JSON serializer options for serializing the object.</param>
/// <returns>The response.</returns>
public static CallToolResponse FromObject(object value, bool isError, JsonSerializerOptions jsonSerializerOptions)
public static CallToolResult FromObject(object value, bool isError, JsonSerializerOptions jsonSerializerOptions)
{
return new CallToolResponse()
return new CallToolResult()
{
IsError = isError,
Content = [new Content() { Text = JsonSerializer.Serialize(value, GetDefaultJsonOptions()) }]
Content = [new TextContentBlock() { Text = JsonSerializer.Serialize(value, GetDefaultJsonOptions()) }]
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/WinGetMCPServer/WingetPackageTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public WingetPackageTools()
ReadOnly = true,
OpenWorld = false)]
[Description("Find installed and available packages using WinGet")]
public CallToolResponse FindPackages(
public CallToolResult FindPackages(
[Description("Find packages identified by this value")] string query)
{
try
Expand Down Expand Up @@ -77,7 +77,7 @@ public CallToolResponse FindPackages(
Idempotent = false,
OpenWorld = false)]
[Description("Install or update a package using WinGet")]
public async Task<CallToolResponse> InstallPackage(
public async Task<CallToolResult> InstallPackage(
[Description("The identifier of the WinGet package")] string identifier,
IProgress<ProgressNotificationValue> progress,
CancellationToken cancellationToken,
Expand Down