Rename ToolRegistration to ToolSpecification (#2859)
Signed-off-by: jitokim <pigberger70@gmail.com>
This commit is contained in:
@@ -157,7 +157,7 @@ public class McpServerAutoConfigurationIT {
|
||||
}
|
||||
|
||||
@Test
|
||||
void toolRegistrationConfiguration() {
|
||||
void toolSpecificationConfiguration() {
|
||||
this.contextRunner.withUserConfiguration(TestToolConfiguration.class).run(context -> {
|
||||
List<SyncToolSpecification> tools = context.getBean("syncTools", List.class);
|
||||
assertThat(tools).hasSize(1);
|
||||
@@ -165,7 +165,7 @@ public class McpServerAutoConfigurationIT {
|
||||
}
|
||||
|
||||
@Test
|
||||
void resourceRegistrationConfiguration() {
|
||||
void resourceSpecificationConfiguration() {
|
||||
this.contextRunner.withUserConfiguration(TestResourceConfiguration.class).run(context -> {
|
||||
McpSyncServer server = context.getBean(McpSyncServer.class);
|
||||
assertThat(server).isNotNull();
|
||||
@@ -173,7 +173,7 @@ public class McpServerAutoConfigurationIT {
|
||||
}
|
||||
|
||||
@Test
|
||||
void promptRegistrationConfiguration() {
|
||||
void promptSpecificationConfiguration() {
|
||||
this.contextRunner.withUserConfiguration(TestPromptConfiguration.class).run(context -> {
|
||||
McpSyncServer server = context.getBean(McpSyncServer.class);
|
||||
assertThat(server).isNotNull();
|
||||
@@ -181,7 +181,7 @@ public class McpServerAutoConfigurationIT {
|
||||
}
|
||||
|
||||
@Test
|
||||
void asyncToolRegistrationConfiguration() {
|
||||
void asyncToolSpecificationConfiguration() {
|
||||
this.contextRunner.withPropertyValues("spring.ai.mcp.server.type=ASYNC")
|
||||
.withUserConfiguration(TestToolConfiguration.class)
|
||||
.run(context -> {
|
||||
|
||||
@@ -96,7 +96,7 @@ public final class McpToolUtils {
|
||||
* 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
|
||||
@@ -161,7 +161,7 @@ public final class McpToolUtils {
|
||||
* </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,
|
||||
@@ -204,7 +204,7 @@ public final class McpToolUtils {
|
||||
* 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
|
||||
@@ -231,26 +231,26 @@ public final class McpToolUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
*/
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
Reference in New Issue
Block a user