mirror of
https://github.com/RightNow-AI/openfang.git
synced 2026-07-30 06:32:17 +00:00
fix MCP
This commit is contained in:
@@ -3996,9 +3996,9 @@ pub async fn network_status(State(state): State<Arc<AppState>>) -> impl IntoResp
|
||||
// Tools endpoint
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// GET /api/tools — List all built-in tool definitions.
|
||||
pub async fn list_tools() -> impl IntoResponse {
|
||||
let tools: Vec<serde_json::Value> = builtin_tool_definitions()
|
||||
/// GET /api/tools — List all tool definitions (built-in + MCP).
|
||||
pub async fn list_tools(State(state): State<Arc<AppState>>) -> impl IntoResponse {
|
||||
let mut tools: Vec<serde_json::Value> = builtin_tool_definitions()
|
||||
.iter()
|
||||
.map(|t| {
|
||||
serde_json::json!({
|
||||
@@ -4009,6 +4009,18 @@ pub async fn list_tools() -> impl IntoResponse {
|
||||
})
|
||||
.collect();
|
||||
|
||||
// Include MCP tools so they're visible in Settings -> Tools
|
||||
if let Ok(mcp_tools) = state.kernel.mcp_tools.lock() {
|
||||
for t in mcp_tools.iter() {
|
||||
tools.push(serde_json::json!({
|
||||
"name": t.name,
|
||||
"description": t.description,
|
||||
"input_schema": t.input_schema,
|
||||
"source": "mcp",
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Json(serde_json::json!({"tools": tools, "total": tools.len()}))
|
||||
}
|
||||
|
||||
|
||||
@@ -1344,7 +1344,7 @@ impl OpenFangKernel {
|
||||
recalled_memories: vec![],
|
||||
skill_summary: self.build_skill_summary(&manifest.skills),
|
||||
skill_prompt_context: self.collect_prompt_context(&manifest.skills),
|
||||
mcp_summary: if mcp_tool_count >= 3 {
|
||||
mcp_summary: if mcp_tool_count > 0 {
|
||||
self.build_mcp_summary(&manifest.mcp_servers)
|
||||
} else {
|
||||
String::new()
|
||||
@@ -1792,7 +1792,7 @@ impl OpenFangKernel {
|
||||
recalled_memories: vec![], // Recalled in agent_loop, not here
|
||||
skill_summary: self.build_skill_summary(&manifest.skills),
|
||||
skill_prompt_context: self.collect_prompt_context(&manifest.skills),
|
||||
mcp_summary: if mcp_tool_count >= 3 {
|
||||
mcp_summary: if mcp_tool_count > 0 {
|
||||
self.build_mcp_summary(&manifest.mcp_servers)
|
||||
} else {
|
||||
String::new()
|
||||
|
||||
Reference in New Issue
Block a user