This commit is contained in:
jaberjaber23
2026-02-27 20:58:34 +03:00
parent 0bb08f4ae1
commit 9fc7ed87be
2 changed files with 17 additions and 5 deletions
+15 -3
View File
@@ -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()}))
}
+2 -2
View File
@@ -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()