Skip to content

fix: typo #2791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -93,13 +93,13 @@ public static String prefixedToolName(String prefix, String toolName) {
}

/**
* Converts a list of Spring AI tool callbacks to MCP synchronous tool specificaiton.
* Converts a list of Spring AI tool callbacks to MCP synchronous tool specification.
* <p>
* This method processes multiple tool callbacks in bulk, converting each one to its
* corresponding MCP tool registration while maintaining synchronous execution
* semantics.
* @param toolCallbacks the list of tool callbacks to convert
* @return a list of MCP synchronous tool specificaiton
* @return a list of MCP synchronous tool specification
*/
public static List<McpServerFeatures.SyncToolSpecification> toSyncToolSpecification(
List<ToolCallback> toolCallbacks) {
Expand All @@ -113,7 +113,7 @@ public static List<McpServerFeatures.SyncToolSpecification> toSyncToolSpecificat
* This is a varargs wrapper around {@link #toSyncToolSpecification(List)} for easier
* usage when working with individual callbacks.
* @param toolCallbacks the tool callbacks to convert
* @return a list of MCP synchronous tool specificaiton
* @return a list of MCP synchronous tool specification
*/
public static List<McpServerFeatures.SyncToolSpecification> toSyncToolSpecifications(
ToolCallback... toolCallbacks) {
Expand Down Expand Up @@ -201,7 +201,7 @@ public static Optional<McpSyncServerExchange> getMcpExchange(ToolContext toolCon
}

/**
* Converts a list of Spring AI tool callbacks to MCP asynchronous tool specificaiton.
* Converts a list of Spring AI tool callbacks to MCP asynchronous tool specification.
* <p>
* This method processes multiple tool callbacks in bulk, converting each one to its
* corresponding MCP tool registration while adding asynchronous execution
Expand All @@ -217,7 +217,7 @@ public static List<McpServerFeatures.AsyncToolSpecification> toAsyncToolSpecific

/**
* Convenience method to convert a variable number of tool callbacks to MCP
* asynchronous tool specificaiton.
* asynchronous tool specification.
* <p>
* This is a varargs wrapper around {@link #toAsyncToolSpecifications(List)} for
* easier usage when working with individual callbacks.
Expand Down Expand Up @@ -264,13 +264,13 @@ public static McpServerFeatures.AsyncToolSpecification toAsyncToolSpecification(
* 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 specificaiton</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 specificaiton will:
* The resulting async specification will:
* <ul>
* <li>Execute the tool without blocking the calling thread</li>
* <li>Handle errors and results asynchronously</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void constructorShouldBePrivate() throws Exception {
}

@Test
void toSyncToolSpecificaitonShouldConvertSingleCallback() {
void toSyncToolSpecificationShouldConvertSingleCallback() {

ToolCallback callback = createMockToolCallback("test", "success");

Expand Down Expand Up @@ -138,7 +138,7 @@ void toSyncToolSpecificationShouldConvertMultipleCallbacks() {
}

@Test
void toAsyncToolSpecificaitonShouldConvertSingleCallback() {
void toAsyncToolSpecificationShouldConvertSingleCallback() {
ToolCallback callback = createMockToolCallback("test", "success");

AsyncToolSpecification toolSpecification = McpToolUtils.toAsyncToolSpecification(callback);
Expand All @@ -160,10 +160,10 @@ void toAsyncToolSpecificaitonShouldConvertSingleCallback() {
void toAsyncToolSpecificationShouldHandleError() {
ToolCallback callback = createMockToolCallback("test", new RuntimeException("error"));

AsyncToolSpecification toolSpecificaiton = McpToolUtils.toAsyncToolSpecification(callback);
AsyncToolSpecification toolSpecification = McpToolUtils.toAsyncToolSpecification(callback);

assertThat(toolSpecificaiton).isNotNull();
StepVerifier.create(toolSpecificaiton.call().apply(mock(McpAsyncServerExchange.class), Map.of()))
assertThat(toolSpecification).isNotNull();
StepVerifier.create(toolSpecification.call().apply(mock(McpAsyncServerExchange.class), Map.of()))
.assertNext(result -> {
TextContent content = (TextContent) result.content().get(0);
assertThat(content.text()).isEqualTo("error");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ Async::
[source,java]
----
List<ToolCallback> toolCallbacks = // obtain tool callbacks
List<AsyncToolSpecification> asyncToolSpecificaitons = McpToolUtils.toAsyncToolSpecifications(toolCallbacks);
List<AsyncToolSpecification> asyncToolSpecifications = McpToolUtils.toAsyncToolSpecifications(toolCallbacks);
----
+
then you can use the `McpServer.AsyncSpecification` to register the tool specifications:
+
[source,java]
----
McpServer.AsyncSpecification asyncSpec = ...
asyncSpec.tools(asyncToolSpecificaitons);
asyncSpec.tools(asyncToolSpecifications);
----
======

Expand Down