Skip to content

Commit 9c03bb1

Browse files
author
黄可欣
committed
恢复testcontroller
1 parent e492942 commit 9c03bb1

File tree

1 file changed

+3
-29
lines changed
  • framework/fel/java/plugins/tool-mcp-test/src/main/java/modelengine/fel/tool/mcp/test

1 file changed

+3
-29
lines changed

framework/fel/java/plugins/tool-mcp-test/src/main/java/modelengine/fel/tool/mcp/test/TestController.java

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
package modelengine.fel.tool.mcp.test;
88

9-
import io.modelcontextprotocol.spec.McpSchema;
109
import modelengine.fel.tool.mcp.client.McpClient;
1110
import modelengine.fel.tool.mcp.client.McpClientFactory;
1211
import modelengine.fel.tool.mcp.entity.Tool;
@@ -19,7 +18,6 @@
1918
import modelengine.fitframework.log.Logger;
2019

2120
import java.io.IOException;
22-
import java.util.HashMap;
2321
import java.util.List;
2422
import java.util.Map;
2523

@@ -48,12 +46,12 @@ public TestController(McpClientFactory mcpClientFactory) {
4846
}
4947

5048
/**
51-
* Initializes the MCP client .
52-
* This method creates an instance using the provided factory and initializes it.
49+
* Initializes the MCP client by creating an instance using the provided factory and initializing it.
50+
* This method sets up the connection to the MCP server and prepares it for further interactions.
5351
*
5452
* @param baseUri The base URI of the MCP server.
5553
* @param sseEndpoint The SSE endpoint of the MCP server.
56-
* @return A map with clientId and status message.
54+
* @return A string indicating that the initialization was successful.
5755
*/
5856
@PostMapping(path = "/initialize")
5957
public String initialize(@RequestQuery(name = "baseUri") String baseUri,
@@ -102,28 +100,4 @@ public List<Tool> toolsList() {
102100
public Object toolsCall(@RequestQuery(name = "name") String name, @RequestBody Map<String, Object> jsonArgs) {
103101
return this.client.callTool(name, jsonArgs);
104102
}
105-
106-
/**
107-
* Custom logging consumer for MCP client.
108-
*
109-
* @param notification The logging message notification from MCP server.
110-
*/
111-
private void loggingConsumer(McpSchema.LoggingMessageNotification notification) {
112-
log.info("Custom logging handler received message. [level={}, data={}]",
113-
notification.level(),
114-
notification.data());
115-
}
116-
117-
/**
118-
* Elicitation handler for MCP client.
119-
*
120-
* @param request The elicitation request from MCP server.
121-
* @return The elicitation result with action and user data.
122-
*/
123-
private McpSchema.ElicitResult elicitationHandler(McpSchema.ElicitRequest request) {
124-
log.info("Elicitation request received. [message={}, schema={}]", request.message(), request.requestedSchema());
125-
Map<String, Object> userData = new HashMap<>();
126-
userData.put("response", "Auto-accepted by test controller");
127-
return new McpSchema.ElicitResult(McpSchema.ElicitResult.Action.ACCEPT, userData);
128-
}
129103
}

0 commit comments

Comments
 (0)