Skip to content

Add [McpServerPrompt] support#126

Merged
stephentoub merged 1 commit intomodelcontextprotocol:mainfrom
stephentoub:mcpserverprompt
Mar 31, 2025
Merged

Add [McpServerPrompt] support#126
stephentoub merged 1 commit intomodelcontextprotocol:mainfrom
stephentoub:mcpserverprompt

Conversation

@stephentoub
Copy link
Copy Markdown
Contributor

Ignore the first commit; that's just #124, which this builds on top of.

I also still need to add tests. I could also use some help on a better word than "Items" when talking about the group of things that is tools, prompts, resources, etc.

This adds support for declaratively and programmatically created prompts, e.g. an [McpServerPrompt] attribute to tag functions that should be used as prompts, a set of McpServerPrompt.Create for programmatically created prompt instances, etc.

Closes #70

@stephentoub stephentoub force-pushed the mcpserverprompt branch 2 times, most recently from 6eaa071 to 9f03dcc Compare March 28, 2025 17:55
@stephentoub stephentoub marked this pull request as ready for review March 28, 2025 17:56
@stephentoub
Copy link
Copy Markdown
Contributor Author

This is ready for review.

Comment thread src/ModelContextProtocol/Server/McpServerTypeAttribute.cs Outdated
Comment thread src/ModelContextProtocol/Server/McpServerToolAttribute.cs Outdated
@PederHP
Copy link
Copy Markdown
Member

PederHP commented Mar 28, 2025

Maybe add WeatherPrompts to the server QuickStart? With example prompts for exercising each tool? This shows both the Prompt feature and helps guide users to using the server correctly (no need to figure out the correct prompt to make the model call the tool).

@stephentoub stephentoub mentioned this pull request Mar 30, 2025
9 tasks
@stephentoub stephentoub force-pushed the mcpserverprompt branch 3 times, most recently from caa949a to d8142fb Compare March 31, 2025 02:50
aaronpowell added a commit to aaronpowell/modelcontextprotocol-csharp-sdk that referenced this pull request Mar 31, 2025
It's not the best handler, but modelcontextprotocol#126 will make this easier
Comment thread src/ModelContextProtocol/Server/IMcpServerPrimitive.cs
@stephentoub stephentoub merged commit 5d3fb65 into modelcontextprotocol:main Mar 31, 2025
8 checks passed
@stephentoub stephentoub deleted the mcpserverprompt branch March 31, 2025 13:54
@jeffhandley jeffhandley added the breaking-change This issue or PR introduces a breaking change label Feb 20, 2026
@jeffhandley
Copy link
Copy Markdown
Contributor

Adding the breaking-change label retroactively during release notes revision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change This issue or PR introduces a breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include PromptType and Prompt attributes

5 participants