init
This commit is contained in:
parent
d762a1fde5
commit
f9330b7d46
@ -1,6 +1,7 @@
|
|||||||
package cn.louisxiv.mcp.dbconnect.config;
|
package cn.louisxiv.mcp.dbconnect.config;
|
||||||
|
|
||||||
import cn.louisxiv.mcp.dbconnect.tool.DbConnectTool;
|
import cn.louisxiv.mcp.dbconnect.tool.DbConnectTool;
|
||||||
|
import cn.louisxiv.mcp.dbconnect.tool.ToUpperCaseTool;
|
||||||
import org.springframework.ai.tool.ToolCallbackProvider;
|
import org.springframework.ai.tool.ToolCallbackProvider;
|
||||||
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
|
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@ -13,7 +14,9 @@ public class AppConfiguration {
|
|||||||
* 声明ToolCallbackProvider
|
* 声明ToolCallbackProvider
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public ToolCallbackProvider toolCallbackProvider(DbConnectTool dbConnectTool) {
|
public ToolCallbackProvider toolCallbackProvider(DbConnectTool dbConnectTool
|
||||||
return MethodToolCallbackProvider.builder().toolObjects(dbConnectTool).build();
|
, ToUpperCaseTool toUpperCaseTool) {
|
||||||
|
return MethodToolCallbackProvider.builder()
|
||||||
|
.toolObjects(dbConnectTool, toUpperCaseTool).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
package cn.louisxiv.mcp.dbconnect.tool;
|
||||||
|
|
||||||
|
import org.springframework.ai.tool.annotation.Tool;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ToUpperCaseTool {
|
||||||
|
|
||||||
|
@Tool(description = "把输入字符串转为大写")
|
||||||
|
public String toUpperCase(String input) {
|
||||||
|
return input.toUpperCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -6,7 +6,7 @@ spring:
|
|||||||
name: mcp-db-connect
|
name: mcp-db-connect
|
||||||
version: 0.0.1
|
version: 0.0.1
|
||||||
type: ASYNC
|
type: ASYNC
|
||||||
sse-message-endpoint: /mcp/sse
|
sse-message-endpoint: /mcp/sse/message
|
||||||
# 退化为STDIO模式需要关闭banner
|
# 退化为STDIO模式需要关闭banner
|
||||||
main:
|
main:
|
||||||
banner-mode: off
|
banner-mode: off
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user