Move functionality out of IMcpClient/Server into extensions (#60)
This commit is contained in:
parent
cdcf134e7a
commit
67320b22d5
4 changed files with 1042 additions and 708 deletions
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Anthropic.SDK" Version="4.4.3" />
|
||||
<PackageReference Include="System.Linq.AsyncEnumerable" Version="10.0.0-preview.1.25080.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Anthropic.SDK;
|
||||
using Anthropic.SDK.Constants;
|
||||
using Anthropic.SDK.Messaging;
|
||||
using System.Linq;
|
||||
using McpDotNet;
|
||||
using McpDotNet.Client;
|
||||
using McpDotNet.Configuration;
|
||||
|
|
@ -46,8 +47,8 @@ internal class Program
|
|||
var client = await GetMcpClientAsync();
|
||||
Console.WriteLine("MCP 'everything' server initialized");
|
||||
Console.WriteLine("Listing tools...");
|
||||
var tools = await client.ListToolsAsync();
|
||||
var anthropicTools = tools.Tools.ToAnthropicTools();
|
||||
var tools = await client.ListToolsAsync().ToListAsync();
|
||||
var anthropicTools = tools.ToAnthropicTools();
|
||||
Console.WriteLine("Tools available:");
|
||||
foreach (var tool in anthropicTools)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.AI" Version="9.3.0-preview.1.25161.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.3.0-preview.1.25161.3" />
|
||||
<PackageReference Include="System.Linq.AsyncEnumerable" Version="10.0.0-preview.1.25080.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ internal class Program
|
|||
var client = await GetMcpClientAsync();
|
||||
Console.WriteLine("MCP 'everything' server initialized");
|
||||
Console.WriteLine("Listing tools...");
|
||||
var tools = await client.ListToolsAsync();
|
||||
var mappedTools = tools.Tools.Select(t => t.ToAITool(client)).ToList();
|
||||
var mappedTools = await client.ListToolsAsync().Select(t => t.ToAITool(client)).ToListAsync();
|
||||
Console.WriteLine("Tools available:");
|
||||
foreach (var tool in mappedTools)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue