From b9bb871787eb0245353ab9cedafb0d3a10580d30 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Tue, 1 Apr 2025 11:59:31 +1100 Subject: [PATCH] Fixing WithPromptsFromAssembly (#174) * Fixing WithPromptsFromAssembly Was looking for tools * Fixing test --- .../Configuration/McpServerBuilderExtensions.cs | 4 ++-- .../Configuration/McpServerBuilderExtensionsPromptsTests.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ModelContextProtocol/Configuration/McpServerBuilderExtensions.cs b/src/ModelContextProtocol/Configuration/McpServerBuilderExtensions.cs index 3fbc4fe..a59de8c 100644 --- a/src/ModelContextProtocol/Configuration/McpServerBuilderExtensions.cs +++ b/src/ModelContextProtocol/Configuration/McpServerBuilderExtensions.cs @@ -176,7 +176,7 @@ public static partial class McpServerBuilderExtensions } /// - /// Adds types marked with the attribute from the given assembly as prompts to the server. + /// Adds types marked with the attribute from the given assembly as prompts to the server. /// /// The builder instance. /// The assembly to load the types from. Null to get the current assembly @@ -190,7 +190,7 @@ public static partial class McpServerBuilderExtensions return builder.WithPrompts( from t in promptAssembly.GetTypes() - where t.GetCustomAttribute() is not null + where t.GetCustomAttribute() is not null select t); } #endregion diff --git a/tests/ModelContextProtocol.Tests/Configuration/McpServerBuilderExtensionsPromptsTests.cs b/tests/ModelContextProtocol.Tests/Configuration/McpServerBuilderExtensionsPromptsTests.cs index 6168c66..53f7d05 100644 --- a/tests/ModelContextProtocol.Tests/Configuration/McpServerBuilderExtensionsPromptsTests.cs +++ b/tests/ModelContextProtocol.Tests/Configuration/McpServerBuilderExtensionsPromptsTests.cs @@ -218,7 +218,7 @@ public class McpServerBuilderExtensionsPromptsTests : LoggedTest, IAsyncDisposab Assert.Contains(services.GetServices(), t => t.ProtocolPrompt.Name == nameof(MorePrompts.AnotherPrompt)); } - [McpServerToolType] + [McpServerPromptType] public sealed class SimplePrompts(ObjectWithId? id = null) { [McpServerPrompt, Description("Returns chat messages")]