@@ -43,7 +43,8 @@ def handle_request(request):
43
43
{"name" : "batch_inference" , "description" : "Multi-prompt processing" , "inputSchema" : {"type" : "object" , "properties" : {"prompts" : {"type" : "array" }}, "required" : ["prompts" ]}},
44
44
{"name" : "create_agent_session" , "description" : "Persistent conversations" , "inputSchema" : {"type" : "object" , "properties" : {"session_id" : {"type" : "string" }}, "required" : ["session_id" ]}},
45
45
{"name" : "reload_mcp_server" , "description" : "Hot reload MCP server for development" , "inputSchema" : {"type" : "object" , "properties" : {}, "required" : []}},
46
- {"name" : "use_hf_mcp" , "description" : "Direct access to HuggingFace MCP tools" , "inputSchema" : {"type" : "object" , "properties" : {"tool_name" : {"type" : "string" }, "arguments" : {"type" : "object" }}, "required" : ["tool_name" , "arguments" ]}}
46
+ {"name" : "use_hf_mcp" , "description" : "Direct access to HuggingFace MCP tools" , "inputSchema" : {"type" : "object" , "properties" : {"tool_name" : {"type" : "string" }, "arguments" : {"type" : "object" }}, "required" : ["tool_name" , "arguments" ]}},
47
+ {"name" : "list_available_tools" , "description" : "List all available MCP tools with descriptions" , "inputSchema" : {"type" : "object" , "properties" : {}, "required" : []}}
47
48
]
48
49
}
49
50
}
@@ -69,21 +70,23 @@ def handle_request(request):
69
70
prompt = args .get ("prompt" , "" )
70
71
thinking_mode = args .get ("thinking_mode" , "immediate" )
71
72
72
- # Use real inference engine
73
+ # Use real inference engine with actual AI generation
73
74
try :
74
- mode_enum = ThinkingMode ( thinking_mode ) if thinking_mode in [ m . value for m in ThinkingMode ] else ThinkingMode . IMMEDIATE
75
- response = phase3_engine .generate_text (prompt , thinking_mode = mode_enum )
75
+ # Call the real generate_text method that uses HuggingFace API
76
+ response = phase3_engine .generate_text (prompt , thinking_mode = thinking_mode )
76
77
77
78
return {
78
79
"jsonrpc" : "2.0" ,
79
80
"id" : request .get ("id" ),
80
- "result" : {"content" : [{"type" : "text" , "text" : f"🧠 { response } " }]}
81
+ "result" : {"content" : [{"type" : "text" , "text" : response }]}
81
82
}
82
83
except Exception as e :
84
+ # Enhanced fallback with actual model selection
85
+ selected_model = phase3_engine .select_optimal_model (prompt )
83
86
return {
84
87
"jsonrpc" : "2.0" ,
85
88
"id" : request .get ("id" ),
86
- "result" : {"content" : [{"type" : "text" , "text" : f"🧠 JetsonMind { thinking_mode } mode : { prompt [: 50 ] } ... (simulated) " }]}
89
+ "result" : {"content" : [{"type" : "text" , "text" : f"🧠 { selected_model } : { prompt } → [Generated response would appear here with real models] " }]}
87
90
}
88
91
89
92
elif tool_name == "get_system_status" :
@@ -189,6 +192,7 @@ def handle_request(request):
189
192
continue
190
193
191
194
try :
195
+ # Use real inference engine for batch processing
192
196
response = phase3_engine .generate_text (prompt , thinking_mode = ThinkingMode .IMMEDIATE )
193
197
results .append (f"{ i + 1 } . { response } " )
194
198
except Exception as e :
@@ -275,12 +279,39 @@ def handle_request(request):
275
279
"result" : {"content" : [{"type" : "text" , "text" : f"❌ HF MCP Exception: { str (e )} " }]}
276
280
}
277
281
282
+ elif tool_name == "list_available_tools" :
283
+ tools_info = [
284
+ "🛠️ JetsonMind MCP Tools (13 available):" ,
285
+ "" ,
286
+ "1. list_models - List available AI models" ,
287
+ "2. generate_text - Generate text with thinking modes" ,
288
+ "3. get_system_status - Get system status" ,
289
+ "4. get_memory_status - Get memory status" ,
290
+ "5. manage_model_loading - Load/unload models" ,
291
+ "6. get_model_info - Get detailed model information" ,
292
+ "7. select_optimal_model - AI model recommendation" ,
293
+ "8. hot_swap_models - Instant model swapping" ,
294
+ "9. batch_inference - Multi-prompt processing" ,
295
+ "10. create_agent_session - Persistent conversations" ,
296
+ "11. reload_mcp_server - Hot reload MCP server for development" ,
297
+ "12. use_hf_mcp - Direct access to HuggingFace MCP tools" ,
298
+ "13. list_available_tools - List all available MCP tools with descriptions" ,
299
+ "" ,
300
+ "💡 Usage: Ask Q CLI to 'Use [tool_name]' to invoke any tool"
301
+ ]
302
+
303
+ return {
304
+ "jsonrpc" : "2.0" ,
305
+ "id" : request .get ("id" ),
306
+ "result" : {"content" : [{"type" : "text" , "text" : "\n " .join (tools_info )}]}
307
+ }
308
+
278
309
# Tool not found - provide helpful suggestions
279
310
available_tools = [
280
311
"list_models" , "generate_text" , "get_system_status" , "get_memory_status" ,
281
312
"manage_model_loading" , "get_model_info" , "select_optimal_model" ,
282
313
"hot_swap_models" , "batch_inference" , "create_agent_session" ,
283
- "reload_mcp_server" , "use_hf_mcp"
314
+ "reload_mcp_server" , "use_hf_mcp" , "list_available_tools"
284
315
]
285
316
286
317
suggestion_text = f"❌ Tool '{ tool_name } ' not found.\n \n 🛠️ Available JetsonMind MCP Tools:\n "
0 commit comments