Skip to content

Commit b9bb871

Browse files
authored
Fixing WithPromptsFromAssembly (#174)
* Fixing WithPromptsFromAssembly Was looking for tools * Fixing test
1 parent 96fa96c commit b9bb871

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/ModelContextProtocol/Configuration/McpServerBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public static IMcpServerBuilder WithPrompts(this IMcpServerBuilder builder, para
176176
}
177177

178178
/// <summary>
179-
/// Adds types marked with the <see cref="McpServerToolTypeAttribute"/> attribute from the given assembly as prompts to the server.
179+
/// Adds types marked with the <see cref="McpServerPromptTypeAttribute"/> attribute from the given assembly as prompts to the server.
180180
/// </summary>
181181
/// <param name="builder">The builder instance.</param>
182182
/// <param name="promptAssembly">The assembly to load the types from. Null to get the current assembly</param>
@@ -190,7 +190,7 @@ public static IMcpServerBuilder WithPromptsFromAssembly(this IMcpServerBuilder b
190190

191191
return builder.WithPrompts(
192192
from t in promptAssembly.GetTypes()
193-
where t.GetCustomAttribute<McpServerToolTypeAttribute>() is not null
193+
where t.GetCustomAttribute<McpServerPromptTypeAttribute>() is not null
194194
select t);
195195
}
196196
#endregion

tests/ModelContextProtocol.Tests/Configuration/McpServerBuilderExtensionsPromptsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public void Register_Prompts_From_Multiple_Sources()
218218
Assert.Contains(services.GetServices<McpServerPrompt>(), t => t.ProtocolPrompt.Name == nameof(MorePrompts.AnotherPrompt));
219219
}
220220

221-
[McpServerToolType]
221+
[McpServerPromptType]
222222
public sealed class SimplePrompts(ObjectWithId? id = null)
223223
{
224224
[McpServerPrompt, Description("Returns chat messages")]

0 commit comments

Comments
 (0)