66
77package modelengine .fel .tool .mcp .test ;
88
9- import io .modelcontextprotocol .spec .McpSchema ;
109import modelengine .fel .tool .mcp .client .McpClient ;
1110import modelengine .fel .tool .mcp .client .McpClientFactory ;
1211import modelengine .fel .tool .mcp .entity .Tool ;
1918import modelengine .fitframework .log .Logger ;
2019
2120import java .io .IOException ;
22- import java .util .HashMap ;
2321import java .util .List ;
2422import 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