modelcontextprotocol / modelcontextprotocol/csharp-sdk
McpServerPrimitiveCollection needs transactions/updates
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Description
Is your feature request related to a problem? Please describe.
I have 1.2 preview.1 and configured client and server to communicate prompt list changed notifications.
// A saved copy of the prompts specified in McpServerOptions custom config.
public static McpServerPrimitiveCollection<McpServerPrompt> Prompts { get; set; }
By adding a prompt here it sends a prompt changed notification to client just fine.
If you are reading from a database though, Clear will send one followed by one for each entry in the database.
That is a lot of network traffic while the prompt list is updated.
It doesn't seem the changed notification has added/removed for individual items so the full list would need to be asked for each change notification.
Describe the solution you'd like
There should be a Reset or Replace or Set option that takes a collection (i.e. IReadOnlyList<McpServerPrompt>) so only one changed notification is sent to client.
Describe alternatives you've considered
I don't see an alternative because once the McpServerOptions have been configured at startup you can't replace the prompt collection.
Additional context
n/a
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating McpServerPrimitiveCollection and McpServerOptions, then trace how Clear and individual collection updates emit prompt-list-changed notifications. Done means a collection replacement operation is available for database-backed updates and produces only one notification for the replacement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100