@@ -35,12 +35,14 @@ public class McpServerFeatures {
3535 * @param prompts The map of prompt specifications
3636 * @param rootsChangeConsumers The list of consumers that will be notified when the
3737 * roots list changes
38+ * @param instructions The server instructions text
3839 */
3940 record Async (McpSchema .Implementation serverInfo , McpSchema .ServerCapabilities serverCapabilities ,
4041 List <McpServerFeatures .AsyncToolSpecification > tools , Map <String , AsyncResourceSpecification > resources ,
4142 List <McpSchema .ResourceTemplate > resourceTemplates ,
4243 Map <String , McpServerFeatures .AsyncPromptSpecification > prompts ,
43- List <BiFunction <McpAsyncServerExchange , List <McpSchema .Root >, Mono <Void >>> rootsChangeConsumers ) {
44+ List <BiFunction <McpAsyncServerExchange , List <McpSchema .Root >, Mono <Void >>> rootsChangeConsumers ,
45+ String instructions ) {
4446
4547 /**
4648 * Create an instance and validate the arguments.
@@ -52,12 +54,14 @@ record Async(McpSchema.Implementation serverInfo, McpSchema.ServerCapabilities s
5254 * @param prompts The map of prompt specifications
5355 * @param rootsChangeConsumers The list of consumers that will be notified when
5456 * the roots list changes
57+ * @param instructions The server instructions text
5558 */
5659 Async (McpSchema .Implementation serverInfo , McpSchema .ServerCapabilities serverCapabilities ,
5760 List <McpServerFeatures .AsyncToolSpecification > tools , Map <String , AsyncResourceSpecification > resources ,
5861 List <McpSchema .ResourceTemplate > resourceTemplates ,
5962 Map <String , McpServerFeatures .AsyncPromptSpecification > prompts ,
60- List <BiFunction <McpAsyncServerExchange , List <McpSchema .Root >, Mono <Void >>> rootsChangeConsumers ) {
63+ List <BiFunction <McpAsyncServerExchange , List <McpSchema .Root >, Mono <Void >>> rootsChangeConsumers ,
64+ String instructions ) {
6165
6266 Assert .notNull (serverInfo , "Server info must not be null" );
6367
@@ -78,6 +82,7 @@ record Async(McpSchema.Implementation serverInfo, McpSchema.ServerCapabilities s
7882 this .resourceTemplates = (resourceTemplates != null ) ? resourceTemplates : List .of ();
7983 this .prompts = (prompts != null ) ? prompts : Map .of ();
8084 this .rootsChangeConsumers = (rootsChangeConsumers != null ) ? rootsChangeConsumers : List .of ();
85+ this .instructions = instructions ;
8186 }
8287
8388 /**
@@ -113,7 +118,7 @@ static Async fromSync(Sync syncSpec) {
113118 }
114119
115120 return new Async (syncSpec .serverInfo (), syncSpec .serverCapabilities (), tools , resources ,
116- syncSpec .resourceTemplates (), prompts , rootChangeConsumers );
121+ syncSpec .resourceTemplates (), prompts , rootChangeConsumers , syncSpec . instructions () );
117122 }
118123 }
119124
@@ -128,13 +133,14 @@ static Async fromSync(Sync syncSpec) {
128133 * @param prompts The map of prompt specifications
129134 * @param rootsChangeConsumers The list of consumers that will be notified when the
130135 * roots list changes
136+ * @param instructions The server instructions text
131137 */
132138 record Sync (McpSchema .Implementation serverInfo , McpSchema .ServerCapabilities serverCapabilities ,
133139 List <McpServerFeatures .SyncToolSpecification > tools ,
134140 Map <String , McpServerFeatures .SyncResourceSpecification > resources ,
135141 List <McpSchema .ResourceTemplate > resourceTemplates ,
136142 Map <String , McpServerFeatures .SyncPromptSpecification > prompts ,
137- List <BiConsumer <McpSyncServerExchange , List <McpSchema .Root >>> rootsChangeConsumers ) {
143+ List <BiConsumer <McpSyncServerExchange , List <McpSchema .Root >>> rootsChangeConsumers , String instructions ) {
138144
139145 /**
140146 * Create an instance and validate the arguments.
@@ -146,13 +152,15 @@ record Sync(McpSchema.Implementation serverInfo, McpSchema.ServerCapabilities se
146152 * @param prompts The map of prompt specifications
147153 * @param rootsChangeConsumers The list of consumers that will be notified when
148154 * the roots list changes
155+ * @param instructions The server instructions text
149156 */
150157 Sync (McpSchema .Implementation serverInfo , McpSchema .ServerCapabilities serverCapabilities ,
151158 List <McpServerFeatures .SyncToolSpecification > tools ,
152159 Map <String , McpServerFeatures .SyncResourceSpecification > resources ,
153160 List <McpSchema .ResourceTemplate > resourceTemplates ,
154161 Map <String , McpServerFeatures .SyncPromptSpecification > prompts ,
155- List <BiConsumer <McpSyncServerExchange , List <McpSchema .Root >>> rootsChangeConsumers ) {
162+ List <BiConsumer <McpSyncServerExchange , List <McpSchema .Root >>> rootsChangeConsumers ,
163+ String instructions ) {
156164
157165 Assert .notNull (serverInfo , "Server info must not be null" );
158166
@@ -173,6 +181,7 @@ record Sync(McpSchema.Implementation serverInfo, McpSchema.ServerCapabilities se
173181 this .resourceTemplates = (resourceTemplates != null ) ? resourceTemplates : new ArrayList <>();
174182 this .prompts = (prompts != null ) ? prompts : new HashMap <>();
175183 this .rootsChangeConsumers = (rootsChangeConsumers != null ) ? rootsChangeConsumers : new ArrayList <>();
184+ this .instructions = instructions ;
176185 }
177186
178187 }
0 commit comments