From d63a860a2f323cdb44ad9aa1c8f96d39492a77b7 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Tue, 1 Apr 2025 11:06:58 +1100 Subject: [PATCH 1/2] Fixing WithPromptsFromAssembly Was looking for tools --- .../Configuration/McpServerBuilderExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ModelContextProtocol/Configuration/McpServerBuilderExtensions.cs b/src/ModelContextProtocol/Configuration/McpServerBuilderExtensions.cs index 3fbc4fea7..a59de8ce8 100644 --- a/src/ModelContextProtocol/Configuration/McpServerBuilderExtensions.cs +++ b/src/ModelContextProtocol/Configuration/McpServerBuilderExtensions.cs @@ -176,7 +176,7 @@ public static IMcpServerBuilder WithPrompts(this IMcpServerBuilder builder, para } /// - /// 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 IMcpServerBuilder WithPromptsFromAssembly(this IMcpServerBuilder b return builder.WithPrompts( from t in promptAssembly.GetTypes() - where t.GetCustomAttribute() is not null + where t.GetCustomAttribute() is not null select t); } #endregion From a42f46bfb3f3cdc152783d123532f0611fb26d78 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Tue, 1 Apr 2025 11:19:04 +1100 Subject: [PATCH 2/2] Fixing test --- .../Configuration/McpServerBuilderExtensionsPromptsTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ModelContextProtocol.Tests/Configuration/McpServerBuilderExtensionsPromptsTests.cs b/tests/ModelContextProtocol.Tests/Configuration/McpServerBuilderExtensionsPromptsTests.cs index 6168c6648..53f7d05c3 100644 --- a/tests/ModelContextProtocol.Tests/Configuration/McpServerBuilderExtensionsPromptsTests.cs +++ b/tests/ModelContextProtocol.Tests/Configuration/McpServerBuilderExtensionsPromptsTests.cs @@ -218,7 +218,7 @@ public void Register_Prompts_From_Multiple_Sources() 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")]