@@ -65,6 +65,7 @@ class McpClientFeatures {
6565 record Async (McpSchema .Implementation clientInfo , McpSchema .ClientCapabilities clientCapabilities ,
6666 Map <String , McpSchema .Root > roots , List <Function <List <McpSchema .Tool >, Mono <Void >>> toolsChangeConsumers ,
6767 List <Function <List <McpSchema .Resource >, Mono <Void >>> resourcesChangeConsumers ,
68+ List <Function <List <McpSchema .ResourceContents >, Mono <Void >>> resourcesUpdateConsumers ,
6869 List <Function <List <McpSchema .Prompt >, Mono <Void >>> promptsChangeConsumers ,
6970 List <Function <McpSchema .LoggingMessageNotification , Mono <Void >>> loggingConsumers ,
7071 Function <McpSchema .CreateMessageRequest , Mono <McpSchema .CreateMessageResult >> samplingHandler ,
@@ -85,6 +86,7 @@ public Async(McpSchema.Implementation clientInfo, McpSchema.ClientCapabilities c
8586 Map <String , McpSchema .Root > roots ,
8687 List <Function <List <McpSchema .Tool >, Mono <Void >>> toolsChangeConsumers ,
8788 List <Function <List <McpSchema .Resource >, Mono <Void >>> resourcesChangeConsumers ,
89+ List <Function <List <McpSchema .ResourceContents >, Mono <Void >>> resourcesUpdateConsumers ,
8890 List <Function <List <McpSchema .Prompt >, Mono <Void >>> promptsChangeConsumers ,
8991 List <Function <McpSchema .LoggingMessageNotification , Mono <Void >>> loggingConsumers ,
9092 Function <McpSchema .CreateMessageRequest , Mono <McpSchema .CreateMessageResult >> samplingHandler ,
@@ -101,6 +103,7 @@ public Async(McpSchema.Implementation clientInfo, McpSchema.ClientCapabilities c
101103
102104 this .toolsChangeConsumers = toolsChangeConsumers != null ? toolsChangeConsumers : List .of ();
103105 this .resourcesChangeConsumers = resourcesChangeConsumers != null ? resourcesChangeConsumers : List .of ();
106+ this .resourcesUpdateConsumers = resourcesUpdateConsumers != null ? resourcesUpdateConsumers : List .of ();
104107 this .promptsChangeConsumers = promptsChangeConsumers != null ? promptsChangeConsumers : List .of ();
105108 this .loggingConsumers = loggingConsumers != null ? loggingConsumers : List .of ();
106109 this .samplingHandler = samplingHandler ;
@@ -128,8 +131,13 @@ public static Async fromSync(Sync syncSpec) {
128131 .subscribeOn (Schedulers .boundedElastic ()));
129132 }
130133
131- List <Function <List <McpSchema .Prompt >, Mono <Void >>> promptsChangeConsumers = new ArrayList <>();
134+ List <Function <List <McpSchema .ResourceContents >, Mono <Void >>> resourcesUpdateConsumers = new ArrayList <>();
135+ for (Consumer <List <McpSchema .ResourceContents >> consumer : syncSpec .resourcesUpdateConsumers ()) {
136+ resourcesUpdateConsumers .add (r -> Mono .<Void >fromRunnable (() -> consumer .accept (r ))
137+ .subscribeOn (Schedulers .boundedElastic ()));
138+ }
132139
140+ List <Function <List <McpSchema .Prompt >, Mono <Void >>> promptsChangeConsumers = new ArrayList <>();
133141 for (Consumer <List <McpSchema .Prompt >> consumer : syncSpec .promptsChangeConsumers ()) {
134142 promptsChangeConsumers .add (p -> Mono .<Void >fromRunnable (() -> consumer .accept (p ))
135143 .subscribeOn (Schedulers .boundedElastic ()));
@@ -150,8 +158,8 @@ public static Async fromSync(Sync syncSpec) {
150158 .subscribeOn (Schedulers .boundedElastic ());
151159
152160 return new Async (syncSpec .clientInfo (), syncSpec .clientCapabilities (), syncSpec .roots (),
153- toolsChangeConsumers , resourcesChangeConsumers , promptsChangeConsumers , loggingConsumers ,
154- samplingHandler , elicitationHandler );
161+ toolsChangeConsumers , resourcesChangeConsumers , resourcesUpdateConsumers , promptsChangeConsumers ,
162+ loggingConsumers , samplingHandler , elicitationHandler );
155163 }
156164 }
157165
@@ -172,6 +180,7 @@ public static Async fromSync(Sync syncSpec) {
172180 public record Sync (McpSchema .Implementation clientInfo , McpSchema .ClientCapabilities clientCapabilities ,
173181 Map <String , McpSchema .Root > roots , List <Consumer <List <McpSchema .Tool >>> toolsChangeConsumers ,
174182 List <Consumer <List <McpSchema .Resource >>> resourcesChangeConsumers ,
183+ List <Consumer <List <McpSchema .ResourceContents >>> resourcesUpdateConsumers ,
175184 List <Consumer <List <McpSchema .Prompt >>> promptsChangeConsumers ,
176185 List <Consumer <McpSchema .LoggingMessageNotification >> loggingConsumers ,
177186 Function <McpSchema .CreateMessageRequest , McpSchema .CreateMessageResult > samplingHandler ,
@@ -184,6 +193,7 @@ public record Sync(McpSchema.Implementation clientInfo, McpSchema.ClientCapabili
184193 * @param roots the roots.
185194 * @param toolsChangeConsumers the tools change consumers.
186195 * @param resourcesChangeConsumers the resources change consumers.
196+ * @param resourcesUpdateConsumers the resource update consumers.
187197 * @param promptsChangeConsumers the prompts change consumers.
188198 * @param loggingConsumers the logging consumers.
189199 * @param samplingHandler the sampling handler.
@@ -192,6 +202,7 @@ public record Sync(McpSchema.Implementation clientInfo, McpSchema.ClientCapabili
192202 public Sync (McpSchema .Implementation clientInfo , McpSchema .ClientCapabilities clientCapabilities ,
193203 Map <String , McpSchema .Root > roots , List <Consumer <List <McpSchema .Tool >>> toolsChangeConsumers ,
194204 List <Consumer <List <McpSchema .Resource >>> resourcesChangeConsumers ,
205+ List <Consumer <List <McpSchema .ResourceContents >>> resourcesUpdateConsumers ,
195206 List <Consumer <List <McpSchema .Prompt >>> promptsChangeConsumers ,
196207 List <Consumer <McpSchema .LoggingMessageNotification >> loggingConsumers ,
197208 Function <McpSchema .CreateMessageRequest , McpSchema .CreateMessageResult > samplingHandler ,
@@ -208,6 +219,7 @@ public Sync(McpSchema.Implementation clientInfo, McpSchema.ClientCapabilities cl
208219
209220 this .toolsChangeConsumers = toolsChangeConsumers != null ? toolsChangeConsumers : List .of ();
210221 this .resourcesChangeConsumers = resourcesChangeConsumers != null ? resourcesChangeConsumers : List .of ();
222+ this .resourcesUpdateConsumers = resourcesUpdateConsumers != null ? resourcesUpdateConsumers : List .of ();
211223 this .promptsChangeConsumers = promptsChangeConsumers != null ? promptsChangeConsumers : List .of ();
212224 this .loggingConsumers = loggingConsumers != null ? loggingConsumers : List .of ();
213225 this .samplingHandler = samplingHandler ;
0 commit comments