demo
This commit is contained in:
parent
b22ee0a1f7
commit
120b5b2242
1 changed files with 49 additions and 9 deletions
|
|
@ -31,15 +31,50 @@ public class McpApplication {
|
|||
var chatClient = chatClientBuilder.defaultFunctions(functionCallbacks.toArray(new McpFunctionCallback[0]))
|
||||
.build();
|
||||
|
||||
var response = chatClient.prompt("What is the content of the test.txt file?").call().content();
|
||||
System.out.println(
|
||||
"Can you connect to my SQLite database and tell me what products are available, and their prices?");
|
||||
|
||||
var response = chatClient.prompt(
|
||||
"Can you connect to my SQLite database and tell me what products are available, and their prices?")
|
||||
.call().content();
|
||||
|
||||
System.out.println(response);
|
||||
|
||||
System.out.println("\nWhat's the average price of all products in the database?");
|
||||
|
||||
response = chatClient.prompt(
|
||||
"Please summarize the content of the test.txt file, covert the result in markdown format and store it into test.md")
|
||||
.call()
|
||||
.content();
|
||||
System.out.println("Summary:" + response);
|
||||
"What's the average price of all products in the database?")
|
||||
.call().content();
|
||||
|
||||
System.out.println(response);
|
||||
|
||||
System.out.println("\nCan you analyze the price distribution and suggest any pricing optimizations?");
|
||||
|
||||
response = chatClient.prompt(
|
||||
"Can you analyze the price distribution and suggest any pricing optimizations?")
|
||||
.call().content();
|
||||
|
||||
System.out.println(response);
|
||||
|
||||
System.out.println("\nCould you help me design and create a new table for storing customer orders?");
|
||||
|
||||
response = chatClient.prompt(
|
||||
"Could you help me design and create a new table for storing customer orders?")
|
||||
.call().content();
|
||||
|
||||
System.out.println(response);
|
||||
|
||||
// var response = chatClient.prompt("What is the content of the test.txt
|
||||
// file?").call().content();
|
||||
|
||||
// System.out.println(response);
|
||||
|
||||
// response = chatClient.prompt(
|
||||
// "Please summarize the content of the test.txt file, covert the result in
|
||||
// markdown format and store it into test.md")
|
||||
// .call()
|
||||
// .content();
|
||||
// System.out.println("Summary:" + response);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -54,11 +89,16 @@ public class McpApplication {
|
|||
}
|
||||
|
||||
@Bean(destroyMethod = "close")
|
||||
public McpSyncClient clientSession() {
|
||||
public McpSyncClient mcpClient() {
|
||||
|
||||
var stdioParams = ServerParameters.builder("npx")
|
||||
.args("-y", "@modelcontextprotocol/server-filesystem",
|
||||
"/Users/christiantzolov/Dev/projects/demo/mcp-server/dir")
|
||||
// var stdioParams = ServerParameters.builder("npx")
|
||||
// .args("-y", "@modelcontextprotocol/server-filesystem",
|
||||
// "/Users/christiantzolov/Dev/projects/demo/mcp-server/dir")
|
||||
// .build();
|
||||
|
||||
var stdioParams = ServerParameters.builder("uvx")
|
||||
.args("mcp-server-sqlite", "--db-path",
|
||||
"/Users/christiantzolov/test.db")
|
||||
.build();
|
||||
|
||||
McpSyncClient mcpClient = null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue