Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,31 +157,31 @@ void serverCapabilitiesConfiguration() {
}

@Test
void toolRegistrationConfiguration() {
void toolSpecificationConfiguration() {
this.contextRunner.withUserConfiguration(TestToolConfiguration.class).run(context -> {
List<SyncToolSpecification> tools = context.getBean("syncTools", List.class);
assertThat(tools).hasSize(1);
});
}

@Test
void resourceRegistrationConfiguration() {
void resourceSpecificationConfiguration() {
this.contextRunner.withUserConfiguration(TestResourceConfiguration.class).run(context -> {
McpSyncServer server = context.getBean(McpSyncServer.class);
assertThat(server).isNotNull();
});
}

@Test
void promptRegistrationConfiguration() {
void promptSpecificationConfiguration() {
this.contextRunner.withUserConfiguration(TestPromptConfiguration.class).run(context -> {
McpSyncServer server = context.getBean(McpSyncServer.class);
assertThat(server).isNotNull();
});
}

@Test
void asyncToolRegistrationConfiguration() {
void asyncToolSpecificationConfiguration() {
this.contextRunner.withPropertyValues("spring.ai.mcp.server.type=ASYNC")
.withUserConfiguration(TestToolConfiguration.class)
.run(context -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static String prefixedToolName(String prefix, String toolName) {
* Converts a list of Spring AI tool callbacks to MCP synchronous tool specificaiton.
* <p>
* This method processes multiple tool callbacks in bulk, converting each one to its
* corresponding MCP tool registration while maintaining synchronous execution
* corresponding MCP tool specification while maintaining synchronous execution
* semantics.
* @param toolCallbacks the list of tool callbacks to convert
* @return a list of MCP synchronous tool specificaiton
Expand Down Expand Up @@ -161,7 +161,7 @@ public static McpServerFeatures.SyncToolSpecification toSyncToolSpecification(To
* </ul>
* @param toolCallback the Spring AI function callback to convert
* @param mimeType the MIME type of the output content
* @return an MCP SyncToolRegistration that wraps the function callback
* @return an MCP SyncToolSpecification that wraps the function callback
* @throws RuntimeException if there's an error during the function execution
*/
public static McpServerFeatures.SyncToolSpecification toSyncToolSpecification(ToolCallback toolCallback,
Expand Down Expand Up @@ -204,7 +204,7 @@ public static Optional<McpSyncServerExchange> getMcpExchange(ToolContext toolCon
* Converts a list of Spring AI tool callbacks to MCP asynchronous tool specificaiton.
* <p>
* This method processes multiple tool callbacks in bulk, converting each one to its
* corresponding MCP tool registration while adding asynchronous execution
* corresponding MCP tool specification while adding asynchronous execution
* capabilities. The resulting specifications will execute their tools on a bounded
* elastic scheduler.
* @param toolCallbacks the list of tool callbacks to convert
Expand All @@ -231,26 +231,26 @@ public static List<McpServerFeatures.AsyncToolSpecification> toAsyncToolSpecific
}

/**
* Converts a Spring AI tool callback to an MCP asynchronous tool registration.
* Converts a Spring AI tool callback to an MCP asynchronous tool specification.
* <p>
* This method enables Spring AI tools to be exposed as asynchronous MCP tools that
* can be discovered and invoked by language models. The conversion process:
* <ul>
* <li>First converts the callback to a synchronous registration</li>
* <li>First converts the callback to a synchronous specification</li>
* <li>Wraps the synchronous execution in a reactive Mono</li>
* <li>Configures execution on a bounded elastic scheduler for non-blocking
* operation</li>
* </ul>
* <p>
* The resulting async registration will:
* The resulting async specification will:
* <ul>
* <li>Execute the tool without blocking the calling thread</li>
* <li>Handle errors and results asynchronously</li>
* <li>Provide backpressure through Project Reactor</li>
* </ul>
* @param toolCallback the Spring AI tool callback to convert
* @return an MCP asynchronous tool registration that wraps the tool callback
* @see McpServerFeatures.AsyncToolRegistration
* @return an MCP asynchronous tool specification that wraps the tool callback
* @see McpServerFeatures.AsyncToolSpecification
* @see Mono
* @see Schedulers#boundedElastic()
*/
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.