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
2 changed files with 277 additions and 263 deletions

View file

@ -6,7 +6,7 @@ public static class McpToolExtensions
{
public static IList<Anthropic.SDK.Common.Tool> ToAnthropicTools(this IEnumerable<McpDotNet.Protocol.Types.Tool> tools)
{
List<Anthropic.SDK.Common.Tool> result = new();
List<Anthropic.SDK.Common.Tool> result = [];
foreach (var tool in tools)
{
var function = tool.InputSchema == null

View file

@ -1,9 +1,10 @@
using McpDotNet.Client;
using McpDotNet.Configuration;
using Microsoft.Extensions.Logging.Abstractions;
using Anthropic.SDK;
using Anthropic.SDK.Messaging;
using Anthropic.SDK;
using Anthropic.SDK.Constants;
using Anthropic.SDK.Messaging;
using McpDotNet.Client;
using McpDotNet.Configuration;
using McpDotNet.Protocol.Transport;
using Microsoft.Extensions.Logging.Abstractions;
internal class Program
{
@ -19,7 +20,7 @@ internal class Program
{
Id = "everything",
Name = "Everything",
TransportType = "stdio",
TransportType = TransportTypes.StdIo,
TransportOptions = new Dictionary<string, string>
{
["command"] = "npx",
@ -85,7 +86,7 @@ internal class Program
foreach (var toolCall in res.ToolCalls)
{
var response = await client.CallToolAsync(toolCall.Name, toolCall.Arguments?.ToMCPArguments());
var response = await client.CallToolAsync(toolCall.Name, toolCall.Arguments?.ToMCPArguments() ?? []);
messages.Add(new Message(toolCall, response.Content[0].Text));
}