|
@@ -1,10 +1,7 @@
|
|
|
package org.ruoyi.mcpserve.service.impl;
|
|
package org.ruoyi.mcpserve.service.impl;
|
|
|
|
|
|
|
|
-import org.ruoyi.mcpserve.entity.McpTool;
|
|
|
|
|
-import org.ruoyi.mcpserve.entity.ThinkMcp;
|
|
|
|
|
import org.ruoyi.mcpserve.entity.ToolSchema;
|
|
import org.ruoyi.mcpserve.entity.ToolSchema;
|
|
|
import org.ruoyi.mcpserve.service.IMCPService;
|
|
import org.ruoyi.mcpserve.service.IMCPService;
|
|
|
-import org.ruoyi.mcpserve.service.McpToolService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.*;
|
|
import org.springframework.http.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -21,14 +18,14 @@ public class FastMCPServiceImpl implements IMCPService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private RestTemplate restTemplate;
|
|
private RestTemplate restTemplate;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private McpToolService mcpToolService;
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<String> supportedTools() {
|
|
public List<String> supportedTools() {
|
|
|
return List.of("queryKnowledgeList", "hospitalActivity", "loginUser");
|
|
return List.of("queryKnowledgeList", "hospitalActivity", "loginUser");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public List<ToolSchema> getToolSchemas() {
|
|
public List<ToolSchema> getToolSchemas() {
|
|
|
Map<String, Object> schema = Map.of(
|
|
Map<String, Object> schema = Map.of(
|
|
@@ -36,11 +33,11 @@ public class FastMCPServiceImpl implements IMCPService {
|
|
|
"properties", Map.of(
|
|
"properties", Map.of(
|
|
|
"username", Map.of(
|
|
"username", Map.of(
|
|
|
"type", "string",
|
|
"type", "string",
|
|
|
- "description", "登录用户名"
|
|
|
|
|
|
|
+ "description", "登录用户名,例如:admin"
|
|
|
),
|
|
),
|
|
|
"password", Map.of(
|
|
"password", Map.of(
|
|
|
"type", "string",
|
|
"type", "string",
|
|
|
- "description", "登录密码"
|
|
|
|
|
|
|
+ "description", "登录密码,例如:admin123"
|
|
|
)
|
|
)
|
|
|
),
|
|
),
|
|
|
"required", List.of("username", "password")
|
|
"required", List.of("username", "password")
|
|
@@ -127,14 +124,6 @@ public class FastMCPServiceImpl implements IMCPService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
public Map<String, Object> dispatch(String tool, Map<String, Object> params) {
|
|
public Map<String, Object> dispatch(String tool, Map<String, Object> params) {
|
|
|
- ThinkMcp thinkMcp = new ThinkMcp();
|
|
|
|
|
- thinkMcp.setState(1);
|
|
|
|
|
- thinkMcp.setMcp(tool);
|
|
|
|
|
-
|
|
|
|
|
- ThinkMcp mcpData = mcpToolService.getThinkMcpData(thinkMcp);
|
|
|
|
|
- if(mcpData == null){
|
|
|
|
|
- return Map.of("code", -1, "message", "不支持的工具: " + tool);
|
|
|
|
|
- }
|
|
|
|
|
switch (tool) {
|
|
switch (tool) {
|
|
|
case "loginUser":
|
|
case "loginUser":
|
|
|
return handleLogin(params);
|
|
return handleLogin(params);
|