Skip to content

Commit b4b3b06

Browse files
committed
Address review comments
Signed-off-by: Christian Tzolov <[email protected]>
1 parent 95d4194 commit b4b3b06

File tree

5 files changed

+30
-34
lines changed

5 files changed

+30
-34
lines changed

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/main/java/org/springframework/ai/mcp/server/autoconfigure/McpBackwardCompatibility.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,9 @@ public List<BiConsumer<McpSyncServerExchange, List<McpSchema.Root>>> syncRootsCh
4444
return List.of();
4545
}
4646

47-
return rootsChangeConsumers.stream().map(c -> new BiConsumer<McpSyncServerExchange, List<McpSchema.Root>>() {
48-
@Override
49-
public void accept(McpSyncServerExchange exchange, List<McpSchema.Root> roots) {
50-
c.accept(roots);
51-
}
52-
}).collect(Collectors.toList());
47+
return rootsChangeConsumers.stream()
48+
.map(c -> (BiConsumer<McpSyncServerExchange, List<McpSchema.Root>>) ((exchange, roots) -> c.accept(roots)))
49+
.toList();
5350
}
5451

5552
@Bean

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/main/java/org/springframework/ai/mcp/server/autoconfigure/McpServerAutoConfiguration.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
* </ul>
9898
* <p>
9999
* WebMvc transport support is provided separately by
100-
* {@link McpWebFluxServerAutoConfiguration}.
100+
* {@link McpWebMvcServerAutoConfiguration}.
101101
*
102102
* @author Christian Tzolov
103103
* @since 1.0.0
@@ -132,12 +132,12 @@ public McpSchema.ServerCapabilities.Builder capabilitiesBuilder() {
132132
@ConditionalOnProperty(prefix = McpServerProperties.CONFIG_PREFIX, name = "type", havingValue = "SYNC",
133133
matchIfMissing = true)
134134
public List<McpServerFeatures.SyncToolSpecification> syncTools(ObjectProvider<List<ToolCallback>> toolCalls,
135-
List<ToolCallback> toolCallbacks2, McpServerProperties serverProperties) {
135+
List<ToolCallback> toolCallbacksList, McpServerProperties serverProperties) {
136136

137137
List<ToolCallback> tools = new ArrayList<>(toolCalls.stream().flatMap(List::stream).toList());
138138

139-
if (!CollectionUtils.isEmpty(toolCallbacks2)) {
140-
tools.addAll(toolCallbacks2);
139+
if (!CollectionUtils.isEmpty(toolCallbacksList)) {
140+
tools.addAll(toolCallbacksList);
141141
}
142142

143143
return this.toSyncToolSpecifications(tools, serverProperties);
@@ -219,11 +219,11 @@ public McpSyncServer mcpSyncServer(McpServerTransportProvider transportProvider,
219219
@Bean
220220
@ConditionalOnProperty(prefix = McpServerProperties.CONFIG_PREFIX, name = "type", havingValue = "ASYNC")
221221
public List<McpServerFeatures.AsyncToolSpecification> asyncTools(ObjectProvider<List<ToolCallback>> toolCalls,
222-
List<ToolCallback> toolCallbacks2, McpServerProperties serverProperties) {
222+
List<ToolCallback> toolCallbackList, McpServerProperties serverProperties) {
223223

224224
List<ToolCallback> tools = new ArrayList<>(toolCalls.stream().flatMap(List::stream).toList());
225-
if (!CollectionUtils.isEmpty(toolCallbacks2)) {
226-
tools.addAll(toolCallbacks2);
225+
if (!CollectionUtils.isEmpty(toolCallbackList)) {
226+
tools.addAll(toolCallbackList);
227227
}
228228

229229
return this.toAsyncToolSpecification(tools, serverProperties);

auto-configurations/models/tool/spring-ai-autoconfigure-model-tool/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
org.springframework.ai.model.tool.autoconfigure.ToolCallingAutoConfiguration
16+
17+
org.springframework.ai.autoconfigure.mcp.server.McpServerAutoConfiguration
18+
org.springframework.ai.autoconfigure.mcp.server.McpWebMvcServerAutoConfiguration
19+
org.springframework.ai.autoconfigure.mcp.server.McpWebFluxServerAutoConfiguration

mcp/common/src/main/java/org/springframework/ai/mcp/McpToolUtils.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* <p>
5151
* This helper class provides methods to:
5252
* <ul>
53-
* <li>Convert Spring AI's {@link ToolCallback} instances to MCP tool registrations</li>
53+
* <li>Convert Spring AI's {@link ToolCallback} instances to MCP tool specification</li>
5454
* <li>Generate JSON schemas for tool input validation</li>
5555
* </ul>
5656
*
@@ -106,7 +106,6 @@ public static List<McpServerFeatures.SyncToolRegistration> toSyncToolRegistratio
106106
* semantics.
107107
* @param toolCallbacks the list of tool callbacks to convert
108108
* @return a list of MCP synchronous tool specificaiton
109-
* @see #toSyncToolRegistration(ToolCallback)
110109
*/
111110
public static List<McpServerFeatures.SyncToolSpecification> toSyncToolSpecification(
112111
List<ToolCallback> toolCallbacks) {
@@ -142,7 +141,6 @@ public static List<McpServerFeatures.SyncToolRegistration> toSyncToolRegistratio
142141
* usage when working with individual callbacks.
143142
* @param toolCallbacks the tool callbacks to convert
144143
* @return a list of MCP synchronous tool specificaiton
145-
* @see #toSyncToolRegistration(List)
146144
*/
147145
public static List<McpServerFeatures.SyncToolSpecification> toSyncToolSpecifications(
148146
ToolCallback... toolCallbacks) {
@@ -312,11 +310,10 @@ public static List<McpServerFeatures.AsyncToolRegistration> toAsyncToolRegistrat
312310
* <p>
313311
* This method processes multiple tool callbacks in bulk, converting each one to its
314312
* corresponding MCP tool registration while adding asynchronous execution
315-
* capabilities. The resulting registrations will execute their tools on a bounded
313+
* capabilities. The resulting specifications will execute their tools on a bounded
316314
* elastic scheduler.
317315
* @param toolCallbacks the list of tool callbacks to convert
318316
* @return a list of MCP asynchronous tool specifications
319-
* @see #toAsyncToolRegistration(ToolCallback)
320317
*/
321318
public static List<McpServerFeatures.AsyncToolSpecification> toAsyncToolSpecifications(
322319
List<ToolCallback> toolCallbacks) {
@@ -325,7 +322,7 @@ public static List<McpServerFeatures.AsyncToolSpecification> toAsyncToolSpecific
325322

326323
/**
327324
* Convenience method to convert a variable number of tool callbacks to MCP
328-
* asynchronous tool registrations.
325+
* asynchronous tool specifications.
329326
* <p>
330327
* This is a varargs wrapper around {@link #toAsyncToolRegistration(List)} for easier
331328
* usage when working with individual callbacks.
@@ -469,7 +466,6 @@ public static McpServerFeatures.AsyncToolRegistration toAsyncToolRegistration(To
469466
* @param mimeType the MIME type of the output content
470467
* @return an MCP asynchronous tool specificaiotn that wraps the tool callback
471468
* @see McpServerFeatures.AsyncToolSpecification
472-
* @see Mono
473469
* @see Schedulers#boundedElastic()
474470
*/
475471
public static McpServerFeatures.AsyncToolSpecification toAsyncToolSpecification(ToolCallback toolCallback,

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/mcp/mcp-server-boot-starter-docs.adoc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Full MCP Server features support with `STDIO` server transport.
3232
The starter activates the `McpServerAutoConfiguration` auto-configuration responsible for:
3333

3434
* Configuring the basic server components
35-
* Handling tool, resource, and prompt specificaitons
35+
* Handling tool, resource, and prompt specifications
3636
* Managing server capabilities and change notifications
3737
* Providing both sync and async server implementations
3838

@@ -89,7 +89,7 @@ All properties are prefixed with `spring.ai.mcp.server`:
8989
|`resource-change-notification` |Enable resource change notifications |`true`
9090
|`prompt-change-notification` |Enable prompt change notifications |`true`
9191
|`tool-change-notification` |Enable tool change notifications |`true`
92-
|`tool-response-mime-type` |(optinal) response MIME type per tool name. For example `spring.ai.mcp.server.tool-response-mime-type.generateImage=image/png` will assosiate the `image/png` mime type with the `generateImage()` tool name |`-`
92+
|`tool-response-mime-type` |(optional) response MIME type per tool name. For example `spring.ai.mcp.server.tool-response-mime-type.generateImage=image/png` will associate the `image/png` mime type with the `generateImage()` tool name |`-`
9393
|`sse-message-endpoint` |SSE endpoint path for web transport |`/mcp/message`
9494
|===
9595

@@ -98,11 +98,11 @@ All properties are prefixed with `spring.ai.mcp.server`:
9898
* **Synchronous Server** - The default server type implemented using `McpSyncServer`.
9999
It is designed for straightforward request-response patterns in your applications.
100100
To enable this server type, set `spring.ai.mcp.server.type=SYNC` in your configuration.
101-
When activated, it automatically handles the configuration of synchronous tool specificaitons.
101+
When activated, it automatically handles the configuration of synchronous tool specifications.
102102

103103
* **Asynchronous Server** - The asynchronous server implementation uses `McpAsyncServer` and is optimized for non-blocking operations.
104104
To enable this server type, configure your application with `spring.ai.mcp.server.type=ASYNC`.
105-
This server type automatically sets up asynchronous tool specificaitons with built-in Project Reactor support.
105+
This server type automatically sets up asynchronous tool specifications with built-in Project Reactor support.
106106

107107
== Transport Options
108108

@@ -115,14 +115,14 @@ The MCP Server supports three transport mechanisms, each with its dedicated star
115115
== Features and Capabilities
116116

117117
The MCP Server Boot Starter allows servers to expose tools, resources, and prompts to clients.
118-
It automatically converts custom capability handlers registered as Spring beans to sync/async specificaitons based on server type:
118+
It automatically converts custom capability handlers registered as Spring beans to sync/async specifications based on server type:
119119

120120
=== link:https://spec.modelcontextprotocol.io/specification/2024-11-05/server/tools/[Tools]
121121
Allows servers to expose tools that can be invoked by language models. The MCP Server Boot Starter provides:
122122

123123
* Change notification support
124-
* Tools are automatically converted to sync/async specificaitons based on server type
125-
* Automatic tool specificaiton through Spring beans:
124+
* Tools are automatically converted to sync/async specifications based on server type
125+
* Automatic tool specification through Spring beans:
126126

127127
[source,java]
128128
----
@@ -148,18 +148,18 @@ public List<McpServerFeatures.SyncToolSpecification> myTools(...) {
148148

149149
Provides a standardized way for servers to expose resources to clients.
150150

151-
* Static and dynamic resource specificaitons
151+
* Static and dynamic resource specifications
152152
* Optional change notifications
153153
* Support for resource templates
154154
* Automatic conversion between sync/async resource specifications
155-
* Automatic resource specificaiton through Spring beans:
155+
* Automatic resource specification through Spring beans:
156156

157157
[source,java]
158158
----
159159
@Bean
160-
public List<McpServerFeatures.SyncResourceSpecificaiton> myResources(...) {
160+
public List<McpServerFeatures.SyncResourceSpecification> myResources(...) {
161161
var systemInfoResource = new McpSchema.Resource(...);
162-
var resourceSpecificaiton = new McpServerFeatures.SyncResourceSpecificaiton(systemInfoResource, (exchange, request) -> {
162+
var resourceSpecification = new McpServerFeatures.SyncResourceSpecification(systemInfoResource, (exchange, request) -> {
163163
try {
164164
var systemInfo = Map.of(...);
165165
String jsonContent = new ObjectMapper().writeValueAsString(systemInfo);
@@ -171,7 +171,7 @@ public List<McpServerFeatures.SyncResourceSpecificaiton> myResources(...) {
171171
}
172172
});
173173
174-
return List.of(resourceSpecificaiton);
174+
return List.of(resourceSpecification);
175175
}
176176
----
177177

@@ -181,7 +181,7 @@ Provides a standardized way for servers to expose prompt templates to clients.
181181

182182
* Change notification support
183183
* Template versioning
184-
* Automatic conversion between sync/async prompt specificaitons
184+
* Automatic conversion between sync/async prompt specifications
185185
* Automatic prompt specification through Spring beans:
186186

187187
[source,java]

0 commit comments

Comments
 (0)