@@ -35,12 +35,14 @@ public class McpServerFeatures {
35
35
* @param prompts The map of prompt specifications
36
36
* @param rootsChangeConsumers The list of consumers that will be notified when the
37
37
* roots list changes
38
+ * @param instructions The server instructions text
38
39
*/
39
40
record Async (McpSchema .Implementation serverInfo , McpSchema .ServerCapabilities serverCapabilities ,
40
41
List <McpServerFeatures .AsyncToolSpecification > tools , Map <String , AsyncResourceSpecification > resources ,
41
42
List <McpSchema .ResourceTemplate > resourceTemplates ,
42
43
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 ) {
44
46
45
47
/**
46
48
* Create an instance and validate the arguments.
@@ -52,12 +54,14 @@ record Async(McpSchema.Implementation serverInfo, McpSchema.ServerCapabilities s
52
54
* @param prompts The map of prompt specifications
53
55
* @param rootsChangeConsumers The list of consumers that will be notified when
54
56
* the roots list changes
57
+ * @param instructions The server instructions text
55
58
*/
56
59
Async (McpSchema .Implementation serverInfo , McpSchema .ServerCapabilities serverCapabilities ,
57
60
List <McpServerFeatures .AsyncToolSpecification > tools , Map <String , AsyncResourceSpecification > resources ,
58
61
List <McpSchema .ResourceTemplate > resourceTemplates ,
59
62
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 ) {
61
65
62
66
Assert .notNull (serverInfo , "Server info must not be null" );
63
67
@@ -78,6 +82,7 @@ record Async(McpSchema.Implementation serverInfo, McpSchema.ServerCapabilities s
78
82
this .resourceTemplates = (resourceTemplates != null ) ? resourceTemplates : List .of ();
79
83
this .prompts = (prompts != null ) ? prompts : Map .of ();
80
84
this .rootsChangeConsumers = (rootsChangeConsumers != null ) ? rootsChangeConsumers : List .of ();
85
+ this .instructions = instructions ;
81
86
}
82
87
83
88
/**
@@ -113,7 +118,7 @@ static Async fromSync(Sync syncSpec) {
113
118
}
114
119
115
120
return new Async (syncSpec .serverInfo (), syncSpec .serverCapabilities (), tools , resources ,
116
- syncSpec .resourceTemplates (), prompts , rootChangeConsumers );
121
+ syncSpec .resourceTemplates (), prompts , rootChangeConsumers , syncSpec . instructions () );
117
122
}
118
123
}
119
124
@@ -128,13 +133,14 @@ static Async fromSync(Sync syncSpec) {
128
133
* @param prompts The map of prompt specifications
129
134
* @param rootsChangeConsumers The list of consumers that will be notified when the
130
135
* roots list changes
136
+ * @param instructions The server instructions text
131
137
*/
132
138
record Sync (McpSchema .Implementation serverInfo , McpSchema .ServerCapabilities serverCapabilities ,
133
139
List <McpServerFeatures .SyncToolSpecification > tools ,
134
140
Map <String , McpServerFeatures .SyncResourceSpecification > resources ,
135
141
List <McpSchema .ResourceTemplate > resourceTemplates ,
136
142
Map <String , McpServerFeatures .SyncPromptSpecification > prompts ,
137
- List <BiConsumer <McpSyncServerExchange , List <McpSchema .Root >>> rootsChangeConsumers ) {
143
+ List <BiConsumer <McpSyncServerExchange , List <McpSchema .Root >>> rootsChangeConsumers , String instructions ) {
138
144
139
145
/**
140
146
* Create an instance and validate the arguments.
@@ -146,13 +152,15 @@ record Sync(McpSchema.Implementation serverInfo, McpSchema.ServerCapabilities se
146
152
* @param prompts The map of prompt specifications
147
153
* @param rootsChangeConsumers The list of consumers that will be notified when
148
154
* the roots list changes
155
+ * @param instructions The server instructions text
149
156
*/
150
157
Sync (McpSchema .Implementation serverInfo , McpSchema .ServerCapabilities serverCapabilities ,
151
158
List <McpServerFeatures .SyncToolSpecification > tools ,
152
159
Map <String , McpServerFeatures .SyncResourceSpecification > resources ,
153
160
List <McpSchema .ResourceTemplate > resourceTemplates ,
154
161
Map <String , McpServerFeatures .SyncPromptSpecification > prompts ,
155
- List <BiConsumer <McpSyncServerExchange , List <McpSchema .Root >>> rootsChangeConsumers ) {
162
+ List <BiConsumer <McpSyncServerExchange , List <McpSchema .Root >>> rootsChangeConsumers ,
163
+ String instructions ) {
156
164
157
165
Assert .notNull (serverInfo , "Server info must not be null" );
158
166
@@ -173,6 +181,7 @@ record Sync(McpSchema.Implementation serverInfo, McpSchema.ServerCapabilities se
173
181
this .resourceTemplates = (resourceTemplates != null ) ? resourceTemplates : new ArrayList <>();
174
182
this .prompts = (prompts != null ) ? prompts : new HashMap <>();
175
183
this .rootsChangeConsumers = (rootsChangeConsumers != null ) ? rootsChangeConsumers : new ArrayList <>();
184
+ this .instructions = instructions ;
176
185
}
177
186
178
187
}
0 commit comments