diff --git a/crates/openfang-api/src/routes.rs b/crates/openfang-api/src/routes.rs index ed36d688..1fe4344d 100644 --- a/crates/openfang-api/src/routes.rs +++ b/crates/openfang-api/src/routes.rs @@ -3996,9 +3996,9 @@ pub async fn network_status(State(state): State>) -> impl IntoResp // Tools endpoint // --------------------------------------------------------------------------- -/// GET /api/tools — List all built-in tool definitions. -pub async fn list_tools() -> impl IntoResponse { - let tools: Vec = builtin_tool_definitions() +/// GET /api/tools — List all tool definitions (built-in + MCP). +pub async fn list_tools(State(state): State>) -> impl IntoResponse { + let mut tools: Vec = 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()})) } diff --git a/crates/openfang-kernel/src/kernel.rs b/crates/openfang-kernel/src/kernel.rs index c825be4b..e9a0ec0e 100644 --- a/crates/openfang-kernel/src/kernel.rs +++ b/crates/openfang-kernel/src/kernel.rs @@ -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()