feat: upgrade ModelContextProtocol 0.1.0-preview.2

This commit is contained in:
geffzhang 2025-03-28 18:13:08 +08:00
parent b80cba3cfc
commit d439d38bb9
5 changed files with 10 additions and 8 deletions

View file

@ -110,7 +110,8 @@
<PackageVersion Include="MSTest.TestFramework" Version="3.1.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="ModelContextProtocol" Version="0.1.0-preview.1.25171.12" />
<PackageVersion Include="ModelContextProtocol" Version="0.1.0-preview.2" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="BotSharp.Core" Version="$(BotSharpVersion)" />

View file

@ -2,7 +2,8 @@ using BotSharp.PizzaBot.MCPServer;
using ModelContextProtocol;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMcpServer().WithTools();
builder.Services.AddMcpServer()
.WithToolsFromAssembly();
var app = builder.Build();
app.MapGet("/", () => "This is a test server with only stub functionality!");

View file

@ -4,10 +4,10 @@ using System.ComponentModel.DataAnnotations;
namespace BotSharp.PizzaBot.MCPServer.Tools;
[McpToolType]
[McpServerToolType]
public static class MakePayment
{
[McpTool(name: "make_payment"), Description("call this function to make payment.")]
[McpServerTool(name: "make_payment"), Description("call this function to make payment.")]
public static string Make_Payment(
[Description("order number"),Required] string order_number,
[Description("total amount"),Required] int total_amount)

View file

@ -6,10 +6,10 @@ using System.Text.Json;
namespace BotSharp.PizzaBot.MCPServer.Tools;
[McpToolType]
[McpServerToolType]
public static class PizzaPrices
{
[McpTool(name: "get_pizza_prices"), Description("call this function to get pizza unit price.")]
[McpServerTool(name: "get_pizza_prices"), Description("call this function to get pizza unit price.")]
public static string GetPizzaPrices(
[Description("The pizza type."), Required] string pizza_type,
[Description("quantity of pizza"), Required] int quantity)

View file

@ -4,10 +4,10 @@ using System.ComponentModel.DataAnnotations;
namespace BotSharp.PizzaBot.MCPServer.Tools;
[McpToolType]
[McpServerToolType]
public static class PlaceOrder
{
[McpTool(name: "place_an_order"), Description("Place an order when user has confirmed the pizza type and quantity.")]
[McpServerTool(name: "place_an_order"), Description("Place an order when user has confirmed the pizza type and quantity.")]
public static string PlaceAnOrder(
[Description("The pizza type."), Required] string pizza_type,
[Description("quantity of pizza"), Required] int quantity,