Skip to content

Commit 22f3f55

Browse files
committed
Fix examples for deprecated usages
- Fix Java FunctionCallback chatClient to use toolNames instead of tools to specify the function name - Fix MCP FileSystem Application ChatClientBuilder to use defaultToolCallbacks instead of defaultTools
1 parent c0cc26b commit 22f3f55

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

misc/spring-ai-java-function-callback/src/main/java/com/example/java_ai_function_callback/SpringAiJavaFunctionCallbackApplication.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ public CommandLineRunner init(ChatClient.Builder chatClientBuilder) {
2626
ChatClient chatClient = chatClientBuilder.build();
2727
ChatResponse response = chatClient
2828
.prompt("What are the weather conditions in San Francisco, Tokyo, and Paris? Find the temperature in Celsius for each of the three locations.")
29-
.tools("WeatherInfo")
29+
.toolNames("WeatherInfo")
3030
.call().chatResponse();
3131

3232
System.out.println("Response: " + response);
33+
System.out.println("Exiting successfully");
34+
System.exit(0);
3335
}
3436
catch (Exception e) {
3537
System.out.println("Error during weather check: " + e.getMessage());

model-context-protocol/filesystem/src/main/java/org/springframework/ai/mcp/samples/filesystem/Application.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public CommandLineRunner predefinedQuestions(ChatClient.Builder chatClientBuilde
2929

3030
return args -> {
3131
var chatClient = chatClientBuilder
32-
.defaultTools(new SyncMcpToolCallbackProvider(mcpClient))
32+
.defaultToolCallbacks(new SyncMcpToolCallbackProvider(mcpClient))
3333
.build();
3434

3535
System.out.println("Running predefined questions with AI model responses:\n");

0 commit comments

Comments
 (0)