From d439d38bb9a68bc3ebff7260bc7f7ae4b153afba Mon Sep 17 00:00:00 2001 From: geffzhang Date: Fri, 28 Mar 2025 18:13:08 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=20upgrade=20ModelContextProtocol?= =?UTF-8?q?=200.1.0-preview.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Directory.Packages.props | 3 ++- tests/BotSharp.PizzaBot.MCPServer/Program.cs | 3 ++- tests/BotSharp.PizzaBot.MCPServer/Tools/MakePayment.cs | 4 ++-- tests/BotSharp.PizzaBot.MCPServer/Tools/PizzaPrices.cs | 4 ++-- tests/BotSharp.PizzaBot.MCPServer/Tools/PlaceOrder.cs | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 3354b992..91fe2944 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -110,7 +110,8 @@ - + + diff --git a/tests/BotSharp.PizzaBot.MCPServer/Program.cs b/tests/BotSharp.PizzaBot.MCPServer/Program.cs index fb39e6cd..d2cf912e 100644 --- a/tests/BotSharp.PizzaBot.MCPServer/Program.cs +++ b/tests/BotSharp.PizzaBot.MCPServer/Program.cs @@ -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!"); diff --git a/tests/BotSharp.PizzaBot.MCPServer/Tools/MakePayment.cs b/tests/BotSharp.PizzaBot.MCPServer/Tools/MakePayment.cs index a236d874..da198c47 100644 --- a/tests/BotSharp.PizzaBot.MCPServer/Tools/MakePayment.cs +++ b/tests/BotSharp.PizzaBot.MCPServer/Tools/MakePayment.cs @@ -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) diff --git a/tests/BotSharp.PizzaBot.MCPServer/Tools/PizzaPrices.cs b/tests/BotSharp.PizzaBot.MCPServer/Tools/PizzaPrices.cs index 7ca766f3..762d67db 100644 --- a/tests/BotSharp.PizzaBot.MCPServer/Tools/PizzaPrices.cs +++ b/tests/BotSharp.PizzaBot.MCPServer/Tools/PizzaPrices.cs @@ -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) diff --git a/tests/BotSharp.PizzaBot.MCPServer/Tools/PlaceOrder.cs b/tests/BotSharp.PizzaBot.MCPServer/Tools/PlaceOrder.cs index a6237b6d..73245751 100644 --- a/tests/BotSharp.PizzaBot.MCPServer/Tools/PlaceOrder.cs +++ b/tests/BotSharp.PizzaBot.MCPServer/Tools/PlaceOrder.cs @@ -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,