Remove warnings from build (#29)

* Remove warnings from build

* More fixes.

* Using const for transport types
This commit is contained in:
Toni Wenzel 2025-03-06 21:02:13 +01:00 • committed by GitHub
commit 7d69499ad5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 277 additions and 263 deletions

View file

@ -16,7 +16,7 @@ internal static class AIFunctionUtilities
["type"] = "object",
["title"] = tool.Name,
["description"] = tool.Description ?? string.Empty,
["properties"] = tool.InputSchema?.Properties ?? new(),
["properties"] = tool.InputSchema?.Properties ?? [],
["required"] = tool.InputSchema?.Required ?? []
};

View file

@ -32,7 +32,7 @@ public class McpAIFunction : AIFunction
protected async override Task<object?> InvokeCoreAsync(IEnumerable<KeyValuePair<string, object?>> arguments, CancellationToken cancellationToken)
{
// Convert arguments to dictionary format expected by mcpdotnet
Dictionary<string, object> argDict = new();
Dictionary<string, object> argDict = [];
foreach (var arg in arguments)
{
if (arg.Value is not null)
@ -44,7 +44,7 @@ public class McpAIFunction : AIFunction
// Call the tool through mcpdotnet
var result = await _client.CallToolAsync(
_tool.Name,
argDict.Count == 0 ? new() : argDict,
argDict.Count == 0 ? [] : argDict,
cancellationToken: cancellationToken
);

View file

@ -14,7 +14,7 @@ namespace McpDotNet.Extensions.AI;
/// </summary>
public class McpSessionScope : IAsyncDisposable
{
private readonly List<IMcpClient> _clients = new();
private readonly List<IMcpClient> _clients = [];
private bool _disposed;
/// <summary>

View file

@ -37,7 +37,7 @@ var config = new McpServerConfig
{
Id = "everything",
Name = "Everything",
TransportType = "stdio",
TransportType = TransportTypes.StdIo,
TransportOptions = new Dictionary<string, string>
{
["command"] = "npx",