[Doc] Add prompts/resources list-changed notification examples to README.md
## Motivation and Context The SDK tiering system (SEP-1730) requires Tier 1 SDKs to document all non-experimental features with examples. The 2026-08-14 documentation coverage audit found the last two example gaps: the Notifications section documents `notify_prompts_list_changed` and `notify_resources_list_changed` in prose, but only `notify_tools_list_changed` appeared in a code example, leaving the prompts and resources variants PARTIAL. The Usage Example in the notifications chapter now defines a prompt and a resource and broadcasts the matching list-changed notification for each, alongside the existing tools example. The block signatures mirror the canonical `define_prompt` / `define_resource` examples earlier in the README.md. ## How Has This Been Tested? Documentation-only change. The snippet was verified end to end against the current public API: both definitions serve `prompts/get` / `resources/read` responses and all three notify calls run without error. ## Breaking Changes None. This only extends a code example in README.md.
This commit is contained in:
parent
0695c43ebe
commit
6a19688cf3
1 changed files with 12 additions and 0 deletions
12
README.md
12
README.md
|
|
@ -2226,6 +2226,18 @@ transport = MCP::Server::Transports::StreamableHTTPTransport.new(server)
|
|||
# When tools change, notify clients
|
||||
server.define_tool(name: "new_tool") { |**args| { result: "ok" } }
|
||||
server.notify_tools_list_changed
|
||||
|
||||
# When prompts change, notify clients
|
||||
server.define_prompt(name: "new_prompt") do |args, server_context:|
|
||||
MCP::Prompt::Result.new(messages: [])
|
||||
end
|
||||
server.notify_prompts_list_changed
|
||||
|
||||
# When resources change, notify clients
|
||||
server.define_resource(uri: "resource://new", name: "new_resource", mime_type: "text/plain") do
|
||||
[MCP::Resource::TextContents.new(uri: "resource://new", mime_type: "text/plain", text: "contents")]
|
||||
end
|
||||
server.notify_resources_list_changed
|
||||
```
|
||||
|
||||
You can use Stateless Streamable HTTP, where notifications are not supported and all calls are request/response interactions.
|
||||
|
|
|
|||
Loading…
Reference in a new issue